I have string with ISO-8859-1 characters in Oct (\350, ...). How to convert them to normal form, for example "\350" -> "è" in Java?
Asked
Active
Viewed 524 times
0
-
What do you mean "string with ISO-8859-1 character". Do you mean a byte array? A String object internally contains UTF-16 bytes. – dsmith Jun 24 '10 at 18:37
-
For example "aaaa\350bbbb c\351ffffff". Actually it is a value of attribute in xml file – balytskyi Jun 24 '10 at 20:05
-
I see no reason that XML attributes should be encoded this way. Are you writing the file? If so using what (serializer)? What's the encoding of the XML file? Is there an encoding declaration at the top? – dsmith Jun 24 '10 at 22:24
-
I'm receiving xml file with ISO-8859-1 encoding declaration. And some characters are encoded in such way – balytskyi Jun 25 '10 at 07:12
1 Answers
0
Octal 350 is the proper code of è. 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.
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.

dsmith
- 1,978
- 10
- 16