Reputation: 1252
I have input string - UAH;"Ãîëüô 855229-7"
, it should be displayed like UAH;"Гольф 855229-7"
, I'm trying to use Cp1251
encoding, but get output UAH;"????? 855229-7"
.
String cyrillic = row[0] + row[1];
String utf8String= new String(cyrillic.getBytes("Cp1251"), "UTF-8");
lbl1.setText(utf8String);
Upvotes: 0
Views: 9477
Reputation: 44345
UTF-8 has nothing to do with this. All of your characters in cyrillic
are being represented as single bytes.
Currently, those bytes are in the ISO 8859-1 encoding, also known as Latin-1, which is a subset of the Windows English code page, Cp1252. So, you want to encode the string as Cp1252, then decode the resulting bytes as Cp1251:
String corrected8String = new String(cyrillic.getBytes("Cp1252"), "Cp1251");
Upvotes: 2