Java Tools Tutorials - Herong's Tutorial Examples - v6.23, by Herong Yang
native2ascii - Encoding Converter Command and Options
This section describes the native-to-ASCII encoding converter 'native2ascii' and its options. Non-ASCII characters in a Java source file must be converted into \uXXXX Unicode sequences before giving it to the Java compiler.
Warning: "native2ascii" has been discontinued since JDK 9. But if you still have JDK 1.8 installed, you can continue to use it to convert Java source from one encoding to another.
What Is "native2ascii"? - "native2ascii" is a command line tool that reads a text file stored in a non-ASCII encoding and converts it to an ASCII text file. All non-ASCII characters will be converted into \uXXXX sequences, where dddd is the Unicode code value of the non-ASCII character.
"native2ascii" has been included in JDK installation since JDK 1.2. And it is represented by the %java_home%\bin\native2ascii.exe program file.
"native2ascii" is an important Java tool, because Java compiler and other Java tools can only process files which contain ASCII characters and \uXXXX Unicode code sequences. If you have any non-ASCII character strings written in a native encoding included in your Java source code, you need to run this "native2ascii" tool to convert your Java source code.
"native2ascii" has the following command syntax:
native2ascii [options] inputfile outputfile
where "options" is a list of these options:
Table of Contents
javac - The Java Program Compiler
java - The Java Program Launcher
jpackage - Binary Package Builder
javadoc - The Java Document Generator
jdeps - The Java Class Dependency Analyzer
jdeprscan - The Java Deprecated API Scanner
jcmd - The JVM Diagnostic Tool
jconsole - Java Monitoring and Management Console
jstat - JVM Statistics Monitoring Tool
jhsdb - The Java HotSpot Debugger
jvisualvm (Java VisualVM) - JVM Visual Tool
javap - The Java Class File Disassembler
keytool - Public Key Certificate Tool
jrunscript - Script Code Shell
►native2ascii - Native-to-ASCII Encoding Converter
►native2ascii - Encoding Converter Command and Options
javac - Using CP1252 to Process Source File
"native2ascii -encoding" - UTF-8 to uXXXX Conversion
Setting UTF-8 Encoding in PrintStream
Converting uXXXX Sequences Back with "-reverse" Option