transcode.java

来自「用户登录,增加,删除,修改,查询数据库,验证码的使用」· Java 代码 · 共 30 行

JAVA
30
字号
package com.hanb.log.tool;

/*
 * Author :moonzhao
 *
 *处理码制转换的类
 *中文是乱码的时候,通过toChinese()方法转换成汉字;
 */
public class TransCode {
    public TransCode(){

    }

    public String toChinese(String ss) {
        //处理中文问题,实现编码转换
        if (ss != null) {
            try {
                String temp_p = ss;
                byte[] temp_t = temp_p.getBytes("ISO8859-1");
                ss = new String(temp_t,"GB2312");
            } catch (Exception e) {
                System.err.println("toChinese exception:" + e.getMessage());
                System.err.println("The String is:" + ss);
            }
        }
        return ss;
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?