說明
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.native2asciiconverts files which contain other character encodings into files containing Latin-1 and/or Unicode-encoded charaters.If
outputfileis omitted, standard output is used for output. If, in addition,inputfileis 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. Theencoding_namestring 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实现国际化 ApplicationResources_zh_CN.properties : title.name=/ufffd/ufffdSTRUTS/u02b5/ufffd/u05b9/ufffd/u02bb/ufffd 保存资源文件时,需要在文件类型选项中选择纯文本类型,编码选择其它>>UTF-8,注意资源文件的扩展名为.properties,文件名可以任意取。 |
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.

本文详细介绍native2ascii工具的功能及使用方法,该工具用于解决Java程序中中文显示问题,特别是针对JAD文件中的中文问题。文章包括如何将本地编码转换为Unicode编码的具体步骤。
1292

被折叠的 条评论
为什么被折叠?



