I understand all these. The problem is that this is the way the data comes
to me from a 3rd party application, with encoded DC hexa. This sample app I
just created it in order to show my problem. 

Any ideas? 

-----Original Message-----
From: Emmanuel Lecharny [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 05, 2007 9:16 PM
To: [email protected]
Subject: Re: Encoder error

Hi,

Burca Ciprian wrote:
>  
>
> I have a proble with Mina. 
>  
> 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:
>   
<snip/>
>  
> public static void main(String[] args) {
>
> try {
>
> //String s2 = "C,NAÜ,LA0";
>
> byte[] b2 = new byte[3];
>
> b2[0] = (byte)0x02;
>
> b2[1] = (byte)220;
>
> b2[2] = (byte)0x03;
>   
This is not the correct encoding for an UTF-8 byte array. The 'Ü' 
character should be encoded 0xC3 0x9C in UTF-8.

Try this :
byte[] ba = new byte[]{ ..., (byte)0xC3, (byte)0x9C, ... };

0xDC is the encoding of 'Ü' in the ISO-8859 mapping .

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org

Reply via email to