native code to ascii

native2ascii [options] [inputfile [outputfile]]

說明

Java 編譯器和其它 Java 工具只能處理含有 Latin-1 和/或 Unicode 編碼(/udddd 記號)字符的文件。native2ascii 將含有其它字符編碼的文件轉換成含 Latin-1 和/或 Unicode 編碼字符的文件。

若省略 outputfile,則使用標準輸出設備輸出。此外,如果也省略 inputfile,則使用標準輸入設備輸入。

選項

-reverse
執行相反的操作:將含 Latin-1 和/或 Unicode 編碼字符的文件轉換成含本地編碼字符的文件:

-encoding encoding_name
指定轉換程序使用的編碼名稱。預設的編碼從系統屬性 file.encoding 中得到。encoding_name 字符串必須是下表第一欄所示的字符串。

Converter kind decription
Big5 Big5 碼,繁體中文
GBK GBK碼,簡體中文

 

-----------------------------------------------------------------------------------------

native2ascii详解

java程序显示中文是大家都遇到过的问题,尤其是JAD文件的中文问题,一般都用native2ascii工具转换,这里收藏了native2ascii工具的详细说明:

native2ascii - Native-to-ASCII Converter

Converts a file with native-encoded characters (characters which are non-Latin 1 and non-Unicode) to one with Unicode-encoded characters.

SYNOPSIS

native2ascii [options] [inputfile [outputfile]]

DESCRIPTION

The Java compiler and other Java tools can only process files which contain Latin-1 and/or Unicode-encoded (/udddd notation) characters. native2ascii converts files which contain other character encodings into files containing Latin-1 and/or Unicode-encoded charaters.

If outputfile is omitted, standard output is used for output. If, in addition, inputfile is omitted, standard input is used for input.

OPTIONS

-reverse
Perform the reverse operation: convert a file with Latin-1 and/or Unicode encoded characters to one with native-encoded characters.

-encoding encoding_name
Specify the encoding name which is used by the conversion procedure. The default encoding is taken from System property file.encoding. The encoding_name string must be a string taken from the first column of the table below.

-------------------------------------------------------------Converter        DescriptionClass-------------------------------------------------------------

> native2ascii -encoding UTF-8 ApplicationResources.properties ApplicationResources_zh_CN.properties

ApplicationResources.properties :

title.name=用STRUTS实现国际化
#this is comment
intdex.copyright=由于STRUTS提供了很好的国际化的支持

ApplicationResources_zh_CN.properties :

title.name=/ufffd/ufffdSTRUTS/u02b5/ufffd/u05b9/ufffd/u02bb/ufffd
#this is comment
intdex.copyright=/ufffd/ufffd/ufffd/ufffdSTRUTS/ufffd/u1e69/ufffd/u02fa/u073a/u00f5/u0139/ufffd/u02bb/ufffd/ufffd/ufffd/u05a7/ufffd/ufffd
注意:

保存资源文件时,需要在文件类型选项中选择纯文本类型,编码选择其它>>UTF-8,注意资源文件的扩展名为.properties,文件名可以任意取。

  Here is the simplified chinese properties file and the conversion result for your reference.

Steps to convert simplified chinese to uni-code:
1. open a command prompt
2. go to the directory which have the simplified chinese properties file that need to convert e.g. applicationResources_original.txt
3. key in the following command "native2ascii -encoding UTF-8 applicationResource_original.txt applicationResource_output.txt
4. Use the applicationResouce_output.txt to replace the old ApplicationResources_zh.properties.

你可能感兴趣的:(native code to ascii)