Java-é成为é©-如何修复 [英] Java - é becomes é - How to fix it
问题描述
我有一个法语的文件夹树。在阅读文件夹/文件时,它返回é而不是é。我替换了字符,但这不是一个好的解决方案。我怎样才能解决这个问题 ?
我在Google上找到了一些答案,但这对我没有帮助。
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.
谢谢!
推荐答案
启动应用程序时,将编码设置为utf-8 :
java -Dfile.encoding="UTF-8" YourMainClass
请注意,如在上面的链接中,许多Java类都缓存编码;因此,如果您在运行时更改编码,则可能不会影响我们所关注的所有类。
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.
从他对的回答中的/stackoverflow.com/users/471272/tchrist\">tchrist https://stackoverflow.com/questions/5688728/php-to-rtf-e-becomes-a>另一个问题:
Copying explanation from tchrist in his answer to another question:
A
\N {带小号的拉丁字母E}
字符是代码点U + 00E9
。
在UTF-8中,即\xC3\xA9
。
但是如果并将这两个字节视为不同的代码
指向 U + 00C3
和 U + 00A9
\N {带
和
波浪符号的拉丁文大写字母A} \N {COPYRIGHT SIGN}
,
But if you turn around and treat those two bytes as distinct code
points U+00C3
and U+00A9
, those are \N{LATIN CAPITAL LETTER A WITH
TILDE}
and \N{COPYRIGHT SIGN}
, respectively.
这篇关于Java-é成为é©-如何修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!