Java 8 RFR 8011194: Apps launched via double-clicked .jars have file.encoding value of US-ASCII on Mac OS X

David DeHaven david.dehaven at oracle.com
Fri Jul 26 21:34:11 UTC 2013


> Please review my fix for 8011194 : "Apps launched via double-clicked .jars have file.encoding value of US-ASCII on Mac OS X"
> 
> http://bugs.sun.com/view_bug.do?bug_id=8011194
> 
> 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.
> 
> (FWIW, this is not recommended by Apple as a method for deploying Java apps [1], 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 [2].

That'd be wonderful! :)

I'm not a "Reviewer" but it looks fine to me.

-DrD-




More information about the core-libs-dev mailing list