Java:希腊文件名问题(非拉丁文件名)
使用Java: 我正在阅读一个包含希腊名称文件的目录。但是当我输出包含文件名的字符串时,我得到这个“??????.something”。
是因为我正在运行java应用程序吗?通过控制台?
有没有办法正确读取非拉丁文件名?
谢谢,
Using Java:
I am reading a directory containing files with Greek Names. But when i output a String containing a file name i get this '???????.something'.
Is it because i am running the java app. through the console?
Is there a way to get non-latin file names read correctly?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它很可能正确读取文件名;最可能的解释是您的控制台无法呈现非拉丁字符。
例如,以下程序应该打印出希腊字母表的前三个字母:
它打印出“???”在我的控制台上,因为它无法渲染希腊字符。
It could well be reading in the file names correctly; the most likely explanation is that your console can't render non-Latin characters.
For example, the following program is supposed to print out the first three letters of the Greek alphabet:
It prints out "???" on my Console, because it's not capable of rendering the Greek characters.
更改您的控制台以使用 utf-8 作为字符编码 - 这应该可以解决该问题
change your console to use utf-8 as char encoding - that should fix that issue
要添加 simonn 所写的内容,值得用如下内容写出 Unicode 代码点:
然后您可以查看 Unicode 网站< /a> 找出这些字符的真正含义。 (代码图表页面非常方便。)
To add to what simonn wrote, it's worth writing out the Unicode code points with something like this:
You can then look at the Unicode web site to find out what those characters really mean. (The Code Charts page is very handy.)