Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, the character encoding used is not directly related to the locale. So changing the locale won't help much.</p> <p>Second, the <code>�</code> is typical for the <a href="http://www.fileformat.info/info/unicode/char/fffd/index.htm" rel="noreferrer">Unicode replacement character U+FFFD</a> <code>�</code> being printed in ISO-8859-1 instead of UTF-8. Here's an evidence:</p> <pre><code>System.out.println(new String("�".getBytes("UTF-8"), "ISO-8859-1")); // � </code></pre> <p>So there are two problems:</p> <ol> <li>Your JVM is reading those special characters as <code>�</code>.</li> <li>Your console is using ISO-8859-1 to display characters.</li> </ol> <p>For a Sun JVM, the VM argument <code>-Dfile.encoding=UTF-8</code> <em>should</em> fix the first problem. The second problem is to be fixed in the console settings. If you're using for example Eclipse, you can change it in <em>Window > Preferences > General > Workspace > Text File Encoding</em>. Set it to UTF-8 as well.</p> <hr> <p><strong>Update</strong>: As per your update:</p> <pre><code>byte[] textArray = f.getName().getBytes(); </code></pre> <p>That should have been the following to exclude influence of platform default encoding:</p> <pre><code>byte[] textArray = f.getName().getBytes("UTF-8"); </code></pre> <p>If that still displays the same, then the problem lies deeper. What JVM exactly are you using? Do a <code>java -version</code>. As said before, the <code>-Dfile.encoding</code> argument is Sun JVM specific. Some Linux machines ships with GNU JVM or OpenJDK's JVM and this argument may then not work.</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