public final class UTF8Tool {
/** Creates a new instance of UTF8Tool */
public final String toUTF8String(String in)throws Exception{
String outer=new String(in.getBytes("ISO8859-1"),"UTF-8");
return outer;
}
}
本文介绍了一个简单的Java工具类,用于实现从ISO-8859-1编码到UTF-8编码的转换。通过提供一个公共最终方法toUTF8String,可以将输入字符串从ISO-8859-1编码转换为UTF-8编码。
public final class UTF8Tool {
/** Creates a new instance of UTF8Tool */
public final String toUTF8String(String in)throws Exception{
String outer=new String(in.getBytes("ISO8859-1"),"UTF-8");
return outer;
}
}
1254

被折叠的 条评论
为什么被折叠?