简体   繁体   English

如何将十月份的带有ISO-8859-1字符的字符串转换为Java中的普通格式

[英]How to convert string with ISO-8859-1 characters in Oct to normal form in Java

I have string with ISO-8859-1 characters in Oct (\\350, ...). 我在10月(\\ 350,...)中有ISO-8859-1字符的字符串。 How to convert them to normal form, for example "\\350" -> "è" in Java? 如何将它们转换为标准格式,例如Java中的“ \\ 350”->“è”?

Octal 350 is the proper code of è. 八进制350是è的正确代码。 Is this what your seeing in a console, or in a file that is displaying in a console? 这是您在控制台或控制台中显示的文件中看到的吗? If so, I suspect the problem is with your terminal-emulator or console configuration. 如果是这样,我怀疑问题出在您的终端仿真器或控制台配置上。 The text in the actual file or screen buffer is in iso-8859-1, your terminal simply can't display it so it write the octal equivalent. 实际文件或屏幕缓冲区中的文本在iso-8859-1中,您的终端根本无法显示该文本,因此它将八进制等效形式写入。

Edit: I've been faced with similar sequences of characters showing up in files, and had stared for hour trying to figure out why they had been replaced in the file, and it turned out that they had not. 编辑:我在文件中遇到了相似的字符序列,并且盯着一个小时试图弄清楚为什么在文件中替换了它们,结果却没有。 It was the software that I was using to view the file that was doing the substitution. 这是我用来查看正在执行替换的文件的软件。 In my case it was putty. 就我而言,那是油灰。 If you think this might be the case I recommend you do a hexdump on the file to verify. 如果您认为可能是这种情况,建议您对文件进行十六进制转储以进行验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM