From the example, I can tell that it is using two bytes Unicode.
Thus I am using 'UTF-16' encoding for InputStreamReader and OutputStreamWriter.
However, it seems that the server running on mobile device doesn't like my configuration file.
By looking into the example and generated files, I notice that it was using little-endian UTF-16.
So I changed to use the following statement to write content in little-endian UTF16 encoding.
OutputStreamWriter out = new OutputStreamWriter(
new FileOutputStream(iniFile), "UTF-16LE");
Here are Unicode table for reference:
Encoding | File initial signature | Java encoding name |
---|---|---|
UTF 8 | FF BB BF | UTF8 |
UTF 16 Big-Endian | FE FF | UTF16-BE |
UTF 16 Little-Endian | FF FE | UTF16-LE |
No comments:
Post a Comment