file.encoding vs. sun.jnu.encoding(?) on OS X

Xueming Shen xueming.shen at
Thu Nov 8 18:36:14 PST 2012


There should be no direct relationship between path name and 
file.encoding after we introduced in
the property sun.jnu.encoding (implementation detail, not a public 
interface) couple release ago. The
charset specified by sun.jnu.encoding should be used for 
decoding/encoding the "java" file path and
native file path, not the one from Charset.defaultCharset(), which is 
from file.encoding.
Alan has a webrev for this one at

I just realized that this one is not in yet. Alan, any reason this one 
is still not pushed in? I think I have
reviewed it already.


On 11/8/2012 11:25 AM, Scott Kovatch wrote:
> Hello,
> I want to bring up something that is causing a lot of confusion, and is generating a lot of bugs on OS X.
> What is the relationship between path names and file.encoding? Or, maybe more correctly, _why_ is there some relationship between path names and file.encoding? On OS X filenames are ALWAYS in UTF-8, so the current locale should never come into play.
> I was about to launch into a discussion (rant) about our use of nl_langinfo(CODESET) for file.encoding, but the more I look into it, I don't think that's the problem, though you can also make a case that all text files on OS X are UTF-8 by default as well. I'm wondering if this has something to do with sun.jnu.encoding being set to the same value as file.encoding.
> -- Scott K.
> ----------------------------------------
> Scott Kovatch
> scott.kovatch at
> Santa Clara/Pleasanton, CA

More information about the jdk8-dev mailing list