> I want to read a unicode String from a file:
> FileInputStream stream = new FileInputStream(file);
[quoted text clipped - 10 lines]
> If I do the following: String unit = "\u00B0" an display this unit on a
> JLabel it displays the '°' correctly.
> What do I do wrong??
Read the stuff using a Reader do not use a plain InputStream
Reader r = new InputStreamReader(new FileInputStream(file), "UTF-8"));
Thomas

Signature
It's not a RootKit - it's a Sony
Simon - 17 Aug 2006 12:15 GMT
Thomas Kellerer schrieb:
>> I want to read a unicode String from a file:
>> FileInputStream stream = new FileInputStream(file);
[quoted text clipped - 16 lines]
>
> Reader r = new InputStreamReader(new FileInputStream(file), "UTF-8"));
Apart from that I understand that the file contains a literal backslash, a "u"
and four digits (as opposed to the file containing the byte sequence that is
represented by "00B0" in hex). Otherwise an InputStream would still not produce
the described output. If this is true, using a Reader will not help.
In that case you can refer to the following article, where it was discussed how
you can parse strings of your type:
news://News.CIS.DFN.de:119/1154597886.093932.227050@75g2000cwc.googlegroups.com
Cheers,
Simon