public static void main(String[] args)
{
String st2;
try {
BufferedReader br =
new BufferedReader(
new InputStreamReader(System.in)
);
st2 = br.readLine();
System.out.println(st2);
st2 = new String(st2.getBytes("UTF-8"),"UTF-8");
System.out.println(st2);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
代码很简单,但是从终端输中文的时候,再输出是乱码,网上找了N种改编码的方法都没有反应,最后找到一种,
我自己试了 下可以用,
参考网址:
http://www.tuicool.com/articles/uEj2qy
主要是修改了下运行时的编码,修改为GBK,应该是系统编码是GBK的