修改编码类型

时间:2021-09-13 20:38:00   收藏:0   阅读:33

代码示例:

/** 把ISO-8859-1码转换成GB2312
 */
public static String ISOtoGB(String iso){
    String gb;
    try{
        if(iso.equals("") || iso == null){
            return "";
        }
        else{
            iso = iso.trim();
            //gb = new String(iso.getBytes("ISO-8859-1"),"GB2312");
            gb = new String(iso.getBytes("UTF-8"),"UTF-8");
            return gb;
        }
    }
    catch(Exception e){
        System.err.print("编码转换错误:"+e.getMessage());
        return "";
    }
}

 

原文:https://www.cnblogs.com/szrs/p/15258003.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!