Converting \udddd Sequences Back with "-reverse" Option

This section provides a tutorial example on how to \udddd Unicode code sequences back to a native encoding like UTF-8 with the 'native2ascii -encoding utf-8 -reverse' command.

"native2ascii" also offers the "-reverse" option to help you convert text files with any \udddd Unicode code sequences back to any native encodings, like UTF-8, or GB2312.

The tutorial example below shows you how I converted some Chinese characters in a UTF-8 file to \udddd Unicode code sequences, then back to a GB2312 encoded file:

C:\herong>type HelloUtf8.java
public class HelloUtf8 {
   public static void main(String[] a) {
      System.out.println("Hello world!"); 	
      System.out.println("世界你好!"); 	
   }
}

C:\herong>native2ascii -encoding utf-8 
   HelloUtf8.java HelloUtf8.unicode

C:\herong>type HelloUtf8.unicode
public class HelloUtf8 {
   public static void main(String[] a) {
      System.out.println("Hello world!");
      System.out.println("\u4e16\u754c\u4f60\u597d\uff01");
   }
}

C:\herong>native2ascii -encoding gb2312 -reverse 
   HelloUtf8.unicode HelloUtf8.gb2312

C:\herong>type HelloUtf8.gb2312
public class HelloUtf8 {
   public static void main(String[] a) {
      System.out.println("Hello world!");
      System.out.println("-++t-p¦+úí");
   }
}

As you can see, if you use "native2ascii" and "native2ascii -reverse" together, you can convert any non-ASCII file from one encoding to another encoding.

Last update: 2015.

Table of Contents

 About This Book

 Java Tools Terminology

 Installing Java 8 on Windows

 'javac' - The Java Program Compiler

 'java' - The Java Program Launcher

 'jdb' - The Java Debugger

 'jconsole' - Java Monitoring and Management Console

 'jstat' - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jvisualvm (Java VisualVM) - JVM Visual Tool

 'jar' - The JAR File Tool

 'javap' - The Java Class File Disassembler

 'keytool' - Public Key Certificate Tool

'native2ascii' - Native-to-ASCII Encoding Converter

 'native2ascii' - Encoding Converter Command and Options

 'javac' Using CP1252 to Process Source File

 UTF-8 to \udddd Conversion with 'native2ascii -encoding'

 Setting UTF-8 Encoding in PrintStream

Converting \udddd Sequences Back with "-reverse" Option

 Outdated Tutorials

 References

 PDF Printing Version