admin 管理员组

文章数量: 1184232


2024年3月10日发(作者:mysql查询工具)

Java字符编码工具类[UTF-8编码实现]

import ortedEncodingException;

import oder;

import oder;

/**

*

Title:字符编码工具类

*

Description:

*

Copyright: Copyright (c) 2005

*

Company:

* @author: jeffzhu

* @version 1.0

*/

public class CharTools {

/**

* 转换编码 ISO-8859-1到GB2312

* @param text

* @return

*/

public String ISO2GB(String text) {

String result = "";

try {

result = new String(es("ISO-8859-1"), "GB2312");

}

catch (UnsupportedEncodingException ex) {

result = ng();

}

return result;

}

/**

* 转换编码 GB2312到ISO-8859-1

* @param text

* @return

*/

public String GB2ISO(String text) {

String result = "";

try {

result = new String(es("GB2312"), "ISO-8859-1");

}

catch (UnsupportedEncodingException ex) {

tackTrace();

}

return result;

}

/**

* Utf8URL编码

* @param s

* @return

*/

public String Utf8URLencode(String text) {

StringBuffer result = new StringBuffer();

for (int i = 0; i < (); i++) {

char c = (i);

if (c >= 0 && c <= 255) {

(c);


本文标签: 编码 工具 字符 查询 作者