Java 8 RFR 8011194: Apps launched via double-clicked .jars have file.encoding value of US-ASCII on Mac OS X
david.holmes at oracle.com
Mon Jul 29 05:13:38 UTC 2013
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?
> (FWIW, this is not recommended by Apple as a method for deploying Java
> apps , though OS X does have a Jar Launcher.app to make it work.)
> It's worth mentioning that this is not something that has ever worked on
> MacOS X. (Apple's JRE defaulted to "MacRoman" for English and AFAIK most
> European locales. I believe this is a holdover from the pre-OS X days).
> Even so, the situation can be improved. When launching, if the standard
> encoding comes up as US-ASCII, but there are no hints from the
> environment (e.g. LANG/etc environment variables), it would be sane to
> instead use UTF-8 as the default encoding on MacOS X. An explicit
> file.encoding setting by the user is still honored (and can even be set
> back to US-ASCII).
> I believe this also fixes the related issue with webstart .
> Webrev is here:
>  http://bugs.sun.com/view_bug.do?bug_id=8011195
More information about the core-libs-dev