I have a folder tree in French. While I'm reading it's folders/files, it returns é instead of é. I replace the character, but it is not a good solution. How can I fix this ? I found some answers on google, but it doesn't help me.
Thanks!
when starting the application, set the encoding to utf-8:
java -Dfile.encoding="UTF-8" YourMainClass
Note that as mentioned in the link above, many Java classes cache the encoding; therefore if you change the encoding during run-time, it may not affect all of the classes that we are concerned.
Copying explanation from tchrist in his answer to another question:
A
\N{LATIN SMALL LETTER E WITH ACUTE}character is code pointU+00E9. In UTF-8, that is\xC3\xA9.But if you turn around and treat those two bytes as distinct code points
U+00C3andU+00A9, those are\N{LATIN CAPITAL LETTER A WITH TILDE}and\N{COPYRIGHT SIGN}, respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With