首页 > 编程知识 正文

java简繁体中文互换java,简体繁体互换

时间:2023-12-27 22:27:14 阅读:325710 作者:QJBF

本文目录一览:

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扩展名

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。