 |
Author |
Topic: utf-8 to iso-8859-2 (Read 2545 times) |
|
eskimoblood

|
utf-8 to iso-8859-2
« on: Mar 11th, 2005, 1:17pm » |
|
I've got a xmlString from a server which is utf-8 encoded. Now I try convert it to iso-8859-2: Code: String s;//paresed XML String byte[] b=s.getBytes("iso-8859-2"); s=new String(b); |
| It works fine to encode a String. But it doesent work to convert a string from utf to iso.
|
|
|
|
eskimoblood

|
Re: utf-8 to iso-8859-2
« Reply #1 on: Mar 14th, 2005, 1:48pm » |
|
I figured out: Code: String utfString="Mönchengladbach"; byte[] b=utfString.getBytes(); String s=new String(b,"utf-8"); byte[] c=s.getBytes("iso-8859-2"); String t=new String(c); or short: String t=new String(new String(utfString.getBytes(),"utf-8").getBytes("iso-8859-2")); |
|
|
« Last Edit: Mar 14th, 2005, 1:48pm by eskimoblood » |
|
|
|
|
|