This content has been marked as final. Show 5 replies
Two things I'd check first are:
1) Are you using the correct input encoding with native2ascii? If your .java file was saved using a different encoding than native2ascii uses to read it, then it might not work properly.
2) Are you sure that whatever you're using to view the output of your program is able to display those characters, regardless of encoding?
First thanks to your reply,
Those mentioned charcters comes under Latin script, the encoding convertor for that is ISO-8859-1 and I used this encoding to generate the ascii using native2ascii.exe and the .java file encoding as ISO-8859-1, but still these characters are displayed as '?' with any encoding convertion.
While running the same code in Java 1.6 it's working fine without encoding also, but I have problem on Java 1.5(we are using Java 1.5).
The characters mentioned are not in ISO-8859-1/Windows-1252 (latin-1), they are in ISO-8859-2/Windows-1250 (latin-2).
Make sure that
1) Your input characterset is correct
2) Your output characterset is correct
3) That java is actually capable of displaying your desired characters on the console.
I encoded the property file with ISO-8859-2 converter
The original is '+Č+, č, ď, ě, ň, ř, ť, ů'
The generated unicode is '+*\u00c4\u008c*+, \u00c4\u008d, \u00c4\u008f, \u00c4\u009b, \u0139\u0088, \u0139\u0099, \u0139\u013d, \u0139\u017b'
On looking the unicoded file for each single character the native to ascii generate two Unicode (highlighted italic).
In the console it prints like this Ä, Ä, Ä, Ä, Ĺ, Ĺ, ĹĽ, ĹŻ.
As mentioned in the pervious reply I set the java file encoding type to the ISO-8859-2 using Eclipse-> selected java file property-> Text file encoding.
I used the following command to generate the Unicode file,
native2ascii.exe -encoding ISO-8859-2 czech.properties cs_CZ.properties
Let me know if I did any mistake on the natvie2ascii.exe
I printed the encoded string as follows
final String ascii =
"\u00c4\u008c, \u00c4\u008d, \u00c4\u008f, \u00c4\u009b, \u0139\u0088, \u0139\u0099, \u0139\u013d, \u0139\u017b";
final OutputStreamWriter outStreamWriter =
new OutputStreamWriter(System.out, "ISO-8859-2");
final PrintWriter writer = new PrintWriter(outStreamWriter, true);
Thanks in advance.
I encoded the property file with ISO-8859-2 converterProperty files have their own encoding: Latin-1 with escape sequences for other characters.