宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

本文目录一览:

  • 1、java 实现 简体gb 到 繁体 再到 big5码 的转换
  • 2、如何用java将繁体字转为简体字
  • 3、java如何做到繁体中文转换

java 实现 简体gb 到 繁体 再到 big5码 的转换

public class CharDecode {

public static void main(String[] args) throws Exception{

// TODO: Add your code here

System.setProperty(“file.encoding”,”big5″);//系统默认字符改成big5

System.out.println(“please enter a chinese String:”);

byte [] buf = new byte[1024];

String strInfo = null;

int pos = 0;

int ch = 0;

while(true)

{

ch = System.in.read();

System.out.println(Integer.toHexString(ch));

switch(ch)

{

case ‘\r’:

break;

case ‘\n’:

strInfo = new String(buf,0,pos);//使用默认字符集

for(int i=0;istrInfo.length();i++)

{

System.out.println(Integer.toHexString(/*(int)*/strInfo.charAt(i)));

}

System.out.println(new String(strInfo.getBytes(“big5″),”gb2312”));//big5转换成gb2312

break;

default:

buf[pos++] = (byte)ch;

}

}

}

}

如何用java将繁体字转为简体字

我不知道你是要自己实现,还是说只要有个类库就可以了,下面是我找的一个类库的实例代码:

package test3;

import net.sf.chineseutils.ChineseUtils;

public class Test {

public static void main(String args[]) throws Exception{

System.out.println(ChineseUtils.simpToTrad(“把BIG5繁体字符串转换成的GB简体字符串。”));

}

}

输出:

把BIG5繁体字符串转换成的GB简体字符串。

java如何做到繁体中文转换

说的不具体,如果是在JSP网页上,可以使用资源文件,properties扩展名