Summary
On macOS
, the initialization of the Java default locale is changed to use the Unix environment variables for locale including LANG
and LC_*
.
Using the Unix environment variables instead of the native macOS
locale
will not be a visible change unless the environment has been modified by the user.
Problem
On macOS
, the Java runtime does not use the Posix locale APIs to initialize the Java system properties that define the default locale. The Posix locale settings are familiar to Unix users via the shell environment variables LANG
and related LC_*
but they are not used by the Java runtime on macOS
. On macOS, the Java runtime uses the Core Foundation APIs for the locale settings. In parallel, macOS initializes the Posix locale from the Core Foundation locale.
The system properties initialized are user.language
, user.script
, user.country
, and user.variant
.
Solution
Change the Java Runtime to set the locale related properties using the Posix setLocale
APIs as is done on other Unix platforms.
A fallback is provided on macOS
to use the Core Foundation locale APIs if thePosix setlocale
API does not provide a locale.
Specification
The system properties user.language
, user.script
, user.country
, and user.variant
are extracted from the BCP47 formatted string returned from
the Posix setlocale
API. If the string is empty or undefined, the property values are set from the corresponding macOS
Core Foundation API.
- csr of
-
JDK-8283697 On macOS, the locale should be settable using environment LANG, LC_*
-
- Closed
-