Encoding issues on Java 7 file names in OS X

前端 未结 1 1740
旧时难觅i
旧时难觅i 2020-12-19 08:02

I have the following code:

public static void main( String[] args ) {
    System.out.println(Locale.getDefault());
    File f = new File(\"/Users/johngoering         


        
相关标签:
1条回答
  • 2020-12-19 08:51

    With some help from Oracle, we discovered a workaround: the environment variable LC_CTYPE was not set to UTF-8 within Eclipse (and when starting from a JNLP or wherever else). This explains why the code worked on the terminal, since the OS X terminal by default "sets the locale environment variables" (an option which can be turned off and then you get the same issue as above even in the terminal).

    Setting this environment variable in the launcher worked around the problem.

    I still consider this a bug for Java 7 because Java 6 still worked even WITHOUT this variable.

    0 讨论(0)
提交回复
热议问题