user1526945
user1526945

Reputation: 1

Convert from unrecognised character to normal form

I have a error with my file. That is, all the characters are like "Giá»âºi tính". I want to use Java to write a program that convert those characters to normal ones. I have tried to convert them to bytes and then convert again to String but it remained the same.

Upvotes: 0

Views: 131

Answers (1)

Adrian
Adrian

Reputation: 46452

You need to know the encoding of the file in order to do this. Java internally represents all Strings as UTF-16; in order to fix the issue, you need to know the encoding of the file, and use that encoding when reading the file: http://goo.gl/PoBgo (Java API Docs)

Upvotes: 1

Related Questions