[Java-gnome-developer] java encoding problems
Brought to you by:
afcowie
From: pancake <pa...@ph...> - 2006-06-15 13:35:41
|
I've written a small program to check a encoding problem that I had suffer with java. I think java-gnome has nothing to do here, but I would like to fix this localization bugs for the next version of gdvb. http://news.nopcode.org/Encoding.tar.gz It reads two files (one with utf8 and the another one in iso8859), and the output is: Using ISO8859_1 for file hello-UTF8 =3D> Contents: 'H=C3=A8llo W=C3=B3rld =C3=A7=C3 =C3=B1=C3' Using ISO8859_1 for file hello-ISO8859 =3D> Contents: 'H=E8llo W=F3rld =E7=C7 =F1=D1' It looks like Java doesn't gets the file encoding automagically, but I don't know how to set the charset for the FileReader class. BTW the other question is..when I've read the string .. do I have to reencode't to the system's default encoding ? The program creates a java-gtk window and shows both strings. The utf8 file was generated by iconv -t UTF8 from the iso8859 one (my system uses iso8859). Thanks. --pancake |