Problems with charset encoding

Hi, my problem is the next: I'm working with Sync4j, and trying to sinchronize a Nokia E61 with OpenGroupware server. The problem is that when I receive the data from the device, it is supose to be in UTF-8, as it is said in the XML headers. I take this data in the next way:

byte[] xml_b =(byte[])syncItem.getPropertyValue(SyncItem.PROPERTY_BINARY_CONTENT);

When I contruct the String object, an print it, i get the next:

SUMMARY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:T=C3=ADtulo

Where "T=C3=ADtulo" should be T韙ulo (obviously in Spanish).

With System.getProperty("file.encoding" );

I know that the charset encoding that I'm using isISO-8859-1, or I think.

Anyone can help me? I need to convert to a readable format.

Thanks

[890 byte] By [Fabiavmza] at [2007-11-27 4:39:38]
# 1
> When I contruct the String object, You have not shown the code that does this. Any reason for not showing it? Could it be that you failed to tell it to use utf-8?String s = new String(xml_b,"utf-8");
sabre150a at 2007-7-12 9:50:22 > top of Java-index,Java Essentials,Java Programming...
# 2

Before you convert the bytes of "T=C3=ADtulo" to a string you should decode the quoted printable -encoded bytes "=C3=AD". This is easy: you drop the =-sign and parse the hexadecimal number that follows to a byte. You can do this yourself or use an API.

http://www.google.com/search?q=quoted+printable+java

Once you have decoded the bytes, you can convert them to a string with new String(xml_b,"utf-8");

jsalonena at 2007-7-12 9:50:22 > top of Java-index,Java Essentials,Java Programming...
# 3
Thanks, I've got it. The solution is byte [] xml_dec = QuotedPrintableCodec.decodeQuotedPrintable(s.getBytes());String xmlAux = new String(xml_dec, "UTF-8");
Fabiavmza at 2007-7-12 9:50:22 > top of Java-index,Java Essentials,Java Programming...
# 4
What is the 's' in byte [] xml_dec = QuotedPrintableCodec.decodeQuotedPrintable(s.getBytes()); ?If it is a String then this is wrong.
sabre150a at 2007-7-12 9:50:22 > top of Java-index,Java Essentials,Java Programming...