converting UTF-8 data into CP1256 (Windows)
807607Dec 4 2006 — edited Dec 4 2006Hello,
i want to convert utf-8 encoded data into cp1256 and save this to a new file but it doesn�t work :( What do i wrong?
try {
Charset csTransformTo=Charset.forName("CP1256");
Charset csTransformFrom=Charset.forName("UTF-8");
out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(fTarget), csTransformTo.name()));
byte[] arr=sbCSVData.toString().getBytes(csTransformFrom.name());
String strIso=new String(arr, csTransformTo.name());
out.write(strIso);
out.close();
} catch (UnsupportedEncodingException e) {
m_catLog.error("Error! Encoding is not supported", e);
} catch (IOException e) {
m_catLog.error("I/O Error!", e);
}
greetings
oase