- 论坛徽章:
- 0
|
/*
* CharacterEncoding.java
*
* Created on 2007年5月15日, 下午2:07
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package tools;
import java.io.UnsupportedEncodingException;
/**
*
* @author
*/
public class CharacterEncoding {
// gb2312转成utf-8编码
public static String enCode(String str) {
if(str==null)return "";
String hs="";
try {
byte b[]=str.getBytes("UTF-16");
//System.out.println(byte2hex(b));
for (int n=0;n
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/55983/showart_1299657.html |
|