Hoi,

Does anyone have experience with ISO-5559-1 to UNICODE convertions for FLASH MX?
I have Turkish and Arabic tekst in my MySQL database with I can display with Arabic (windows) an Turkish (windows) charactercode without any problem.
But displaying it in xml (utf-8) for Flash does introduce a lot of problems.
I am using the encoding/decoding code from java 1.4.1 which does work fine for west european languages, but for Turkish and Arabic text it does NOT. Test code from the web for Turkish and Arabic does work, so I guess the Flash app. does work fine. Its the encoding/decoding which seems to give the problems.
code:
/**
* Return the Unicode character set
*/
public String getUTF8(String body) {
Create the encoder and decoder for ISO-8859-1
Charset charset = Charset.forName("ISO-8859-1");
CharsetDecoder decoder = charset.newDecoder();
Charset charsetUTF8 = Charset.forName("UTF-8");
CharsetEncoder encoder = charsetUTF8.newEncoder();
String ret=new String();
try {
//Convert a string to ISO-LATIN-1 bytes in a ByteBuffer
//The new ByteBuffer is ready to be read.
ByteBuffer bbuf = encoder.encode(CharBuffer.wrap(body.toCharAr
ray()));
// Convert ISO-LATIN-1 bytes in a ByteBuffer to a
// character ByteBuffer and then to a string.
// The new ByteBuffer is ready to be read.
CharBuffer cbuf = decoder.decode(bbuf);
ret = cbuf.toString();
} catch (CharacterCodingException e) {
}
return ret;
}



Does anyone have any ideas??


--
Ruud





Reply via email to