从Java执行命令时如何在Java中将cmd response(Locale specific)转换为ASCII值

时间:2019-05-07 09:56:20

标签: java keystore

我正在从Java程序执行命令,我必须在不同的语言环境中运行该程序,而从日语语言环境中运行该程序,我得到日语字符作为响应,但是Java程序给我输出乱码,如何转换这些字符转换为JAVA中的ASCII字符

       Runtime rt = Runtime.getRuntime();
        Process proc = rt.exec(command);

        br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
        br1 = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
        proc.waitFor();
        String str = br.readLine();
        while (str != null) 
        {
            result = result + str + "\n";//NO I18N
            str = br.readLine();
        }
        str = br1.readLine();
        while (str != null) 
        {
            result = result + str;
            str = br1.readLine();
        }

0 个答案:

没有答案