JDK-8003228 : (props) sun.jnu.encoding should be set to UTF-8 [macosx]
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2012-11-09
  • Updated: 2018-04-25
  • Resolved: 2013-04-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7u40Fixed 8Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
sun.jnu.encoding is the encoding used for encoding/decoding file paths and is defaulting to the value of file.encoding on Mac. It has been suggested that this should be changed to always be UTF-8. Before doing that we require some technical reference to ensure that this is the right thing to do.
verified in b85

I have reproduced the problem described by the CAP member. However, the issue is with the "file.encoding" property, and this bug was meant only to cover "sun.jnu.encoding", which it has, so I'm closing this issue. I have filed a new issues to cover the problem of file.encoding when launching apps on Mac via double-clicked .jar (JDK-8011194) or via webstart (JDK-8011195).

More information from CAP member - Running from the cmdline actually gives the system property "file.encoding" a working value of "UTF-8" and not "US_ASCII" as double clicking the jar file. to reproudce the problem, just make an executable jar file that prints the value of the system property "file.encoding". It should not be "US_ASCII" as that disables the use of accented characters in file names. jAlbum is developed by using Netbeans. jAlbum isn't launched via webstart.It can be workarounded by explicitly passing -Dfile.encoding=UTF-8 as a startup parameter, but it is still better if this bug is fixed instead (there may always be users who miss such startup parameters for instance)

CAP member had tried on the latest JDK 8 build(b81), but the file.encoding was still set to US_ASCII, does not seem the problem had been fixed.

CAP member had reported the same issue and would like the fix backported to 7u release as well.

This technical Q&A from Apple: http://developer.apple.com/library/mac/#qa/qa1173/_index.html states: "The lowest levels of Mac OS X...treat file names as UTF-8 encoded Unicode strings."

See thread at: http://mail.openjdk.java.net/pipermail/jdk8-dev/2012-November/001609.html The main thing we need is an authoritative reference that confirms that sun.jnu.encoding should be fixed as UTF-8 on Mac.