Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I am trying to track down the problem. Here is what I already have:</p> <p>There is <code>Exists.java</code>:</p> <pre><code>import java.io.*; public class Exists { public static void main(String[] args) { new File("aaa").exists(); new File("aaa\u00E4").exists(); new File("aaa\u00C3\u00A4").exists(); } } </code></pre> <p>And there is <code>java -version</code>:</p> <pre><code>java version "1.6.0_20" Java(TM) SE Runtime Environment (build 1.6.0_20-b02) Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode) </code></pre> <p>Now to the interesting part:</p> <pre><code>$ strace -f -o strace.out java Exists &amp;&amp; grep 'stat("aaa' strace.out 31942 stat("aaa", 0x41464950) = -1 ENOENT (No such file or directory) 31942 stat("aaa\303\244", 0x41464950) = -1 ENOENT (No such file or directory) 31942 stat("aaa\303\203\302\244", 0x41464950) = -1 ENOENT (No such file or directory) </code></pre> <p>The nice thing is that <code>strace</code> works on byte-level, not character-level like Java. So everything is ok in this case. I have the environment variable <code>LANG</code> set to <code>en_US.UTF-8</code>, all of the <code>LC_*</code> variables are unset.</p> <p>Now tracking down the problem to a minimal working example:</p> <pre><code>$ strace -f -o strace.out env - LC_ALL=en_US.UTF-8 /home/roland/bin/java Exists &amp;&amp; grep 'stat("aaa' strace.out 31968 stat("aaa", 0x41a75950) = -1 ENOENT (No such file or directory) 31968 stat("aaa\303\244", 0x41a75950) = -1 ENOENT (No such file or directory) 31968 stat("aaa\303\203\302\244", 0x41a75950) = -1 ENOENT (No such file or directory) </code></pre> <p>That still works. So let's try another encoding:</p> <pre><code>$ strace -f -o strace.out env - LANG=en_US.ISO-8859-1 /home/roland/bin/java Exists &amp;&amp; grep 'stat("aaa' strace.out 32070 stat("aaa", 0x407a3950) = -1 ENOENT (No such file or directory) 32070 stat("aaa?", 0x407a3950) = -1 ENOENT (No such file or directory) 32070 stat("aaa??", 0x407a3950) = -1 ENOENT (No such file or directory) </code></pre> <p>So this doesn't work. One possible reason might be that I selected a locale that is not in the list printed by <code>locale -a</code>. But this shouldn't be the reason for Java to convert the letters to question marks.</p> <p>As soon as LANG points to a non-existing locale, the setting of the <code>sun.jnu.encoding</code> property doesn't have any effect anymore. So I'm out of ideas now.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload