Java 8 RFR 8011194: Apps launched via double-clicked .jars have file.encoding value of US-ASCII on Mac OS X
brent.christian at oracle.com
Mon Jul 29 19:54:08 UTC 2013
On 7/28/13 10:13 PM, David Holmes wrote:
> On 27/07/2013 3:53 AM, Brent Christian wrote:
>> Please review my fix for 8011194 : "Apps launched via double-clicked
>> .jars have file.encoding value of US-ASCII on Mac OS X"
>> In most cases of launching a Java app on Mac (from the cmdline, or from
>> a native .app bundle), reading and displaying UTF-8 characters beyond
>> the standard ASCII range works fine.
>> A notable exception is the launching of an app by double-clicking a .jar
>> file. In this case, file.encoding defaults to US-ASCII, and characters
>> outside of the ASCII range show up as garbage.
> Why does this occur? What sets the encoding to US-ASCII?
"US-ASCII" is the answer we get from nl_langinfo(CODESET) because no
values for LANG/LC* are set in the environment when double-clicking a .jar.
We get "UTF-8" when launching from the command line because the default
Terminal.app setup on Mac will setup LANG for you (to "en_US.UTF-8" in
More information about the core-libs-dev