Java native2ascii 简单转码
native2ascii.exe 是 Java 的一个文件转码工具,是将特殊各异的内容 转为 用指定的编码标准文体形式统一的表现出来,它通常位于 JDK_home\bin 目录下,安装好 Java SE 后,可在命令行直接使用 native2ascii 命令进行转码,示例:
native2ascii -encoding 8859_1 c:\test.txt c:\temp.txt
将 test.txt 文件内容用 8859_1 转码,另存为 temp.txt 文件
格式:native2ascii -[options] [inputfile [outputfile]]
参数选项 options
-reverse:将 Latin-1 或 Unicode 编码转为本地编码
-encoding encoding_name:指定转换时使用的编码
inputfile:要转换的文件
outputfile:转换后的文件
互转(-encoding,非英文内容(如中文)转为编码符 或 编码符之间的转换),
逆转(-reverse,通常是将编码符转为非英文内容,或非英文内容之间的转换),
逆转时被转的文件编码和本地编码需一致,示例:
中文转为 ISO 8859_1 编码后,将 8859_1 码转为中文:
native2ascii -encoding 8859_1 c:\a.txt c:\b.txt,将 a 用 8859_1 转码,存为 b (8859_1 码)
native2ascii -encoding GBK c:\b.txt c:\c.txt,将 b 用 GBK 转码,存为 c (GBK 码)
native2ascii -reverse c:\c.txt c:\d.txt,将 GBK 编码 c 用本地编码转码,存为 d (中文内容)
中文转为 GBK 编码后,将 GBK 码转为中文:
native2ascii -encoding GBK c:\a.txt c:\b.txt,将 a 用 GBK 转码,存为 b (GBK 码)
native2ascii -reverse c:\b.txt c:\c.txt,将 GBK 编码 b 用本地编码转码,存为 c (中文内容)
例如struts国际化utf-8的转换方式:
native2ascii -encoding UTF-8 ApplicationResources_zh_src.properties ApplicationResources_zh.properties
[最后修改由 skivet, 于 2008-03-22 18:55:26]
相关文档:
Java字符串使用总结
前言:
这篇文章的目的是提醒大家对字符串三种类型做个综合的比较,使得在使用字符串三种类的时候有个选择依据,这样可以极大提高程序运行的效率。如果你对这 ......
import java.io.*;
public class FileReaderSample {
public static void main(String args[]) throws IOException
{
// 建立可容纳1024个字符的数组
char data[]=new char[1024];
// 建立对象fr
FileReader fr= ......
http://liuleijsjx.javaeye.com/blog/422343
本人刚写的学习心得 希望能有所帮助
/**
*代码实例 通过反编译查看keytool的java code获得的数字证书的内部生成方法
*推荐使用jdk1.5
**/
1。首先生成selfcert
CertAndKeyGen cak = new CertAndKeyGen("RSA","MD5WithRSA",null);
//参数分别为 公钥 ......
一:无返回值的存储过程
存储过程为:
create or replace procedure adddept(deptno number,dname varchar2,loc varchar2)
as
begin
insert into dept values(deptno,dname,loc);
end;
然后呢,在java里调用时就用下面的代码:
public class TestProcedure {
Connectio ......
网址: http://blog.csdn.net/justinavril/archive/2008/08/06/2775767.aspx
import
java.io.*;
public
class
FileToString {
public
static
String readFile(String fileName)  ......