Burca Ciprian wrote:
I receive from a 3rd party application a message containing a hexa char
"DC". When I try to decode, I get an error. The character should be Ü. Here
is a simple application that shows my problem:

You need to be consistent with your encodings. You specified a UTF-8 decoder, but the DC encoding for Ü is not UTF-8, its ISO-8859-1 (and several others: http://www.eki.ee/letter/chardata.cgi?ucode=00dc). The UTF-8 encoding is C39C.

The foolproof way to create the String with that character that avoids potential issues with javac using default platform encodings -- see native2ascii):

String s2 = "\u00dc";
byte[] b2 = s2.getBytes("UTF-8");

Cheers,
Raman Gupta

Reply via email to