Thursday, January 29, 2015

native2ascii - Native-to-ASCII Converter in Java

This utility converts a file with characters in any supported character encoding to one with ASCII and/or Unicode escapes, or visa versa.

You already have this tool if you have JDK. It is present in your JDK installation bin folder. Its recommended to add JAVA_HOME to your PATH environment variable for access of java tools throughout your machine.


native2ascii [options] [inputfile [outputfile]]

This is useful in translation of some string (error messages or labels or help text etc.) to Unicode format which is recognized by the Java compiler. Java tools cannot process characters other than Latin-1 or Unicode, so this native2ascii tool comes handy to convert your strings to Unicode format. I encountered this in regards to translating a few error messages. The obvious benefit is that most (or any) of the text editors or IDEs would support simple unicoded characters rather than different locales, without the need to install locale packages. And this guy also tells us something he knows about it!

An example usage if both files are in same location is as below:

>native2ascii -encoding utf8 otherlocale.txt translated.txt



Read More:

No comments:

Post a Comment

Liked or hated the post? Leave your words of wisdom! Thank you :)