> Thanks a lot !
>
> That's is exactly what I needed and it gives something like
>
> String s = rawCode;
You don't use the s below, but rawCode (should not matter).
> byte c = new byte[1]
This should definitively be char[], not byte[].
> try {
> c[0] = Integer.decode("0x" + rawCode.substring(2)).byteValue();
You certainly want .intValue(), not .byteValue(). Remember that
char --- in Java and very much unlike C/C++ --- is 2 bytes long.
In addition I would rather use
c[0] = Integer.parseInt(rawCode.substring(2), 16);
> } catch (NumberFormatExceptione){e.printStackTrace();}
> String result = new String(c);
>
> Could I have encoding problems with that code ? or should it worked on
> any situation ?
I assume you checked before that rawCode starts with '\\' and 'u'
and that it contains at most 4 hex digits. If it contains 5, digits,
you loose
something in the cast to char.
Harald.
Well probably nobody care, but the code above does not work:
the following seems to be alright:
char c[] = new char[n]
s has been read in a file and contain "\u2079" for example
...
c[i]= (char)Integer.parseInt(s.substring(2),16);
...
and for the whole array c
String result = new String(c);
Francois