就好比,现在有一个非java程序。他向你的程序发送一个字符串,传送前首先需要进行编码。他按gbk编码后给你的java程序。但是你输入流接受的时候却用了iso8859-1进行解码。于是,你看到的串就不是。他发送时候的了。这个时候你才需要new String(getBytes("iso8859-1"),"gbk").这时候才是需要人工转码的时候。 [解决办法] You could try to generate the .class files directly via the CMD. (reference: http://blog.csdn.net/gaowen_han/article/details/7163775) To verify that the execution of the compiled file does not appear the irrecognizable codes. And then pack the .class files into .jar file through CMD. (reference: http://blog.csdn.net/gaowen_han/article/details/7246562)
We can do also a small test: run via CMD the class file extracted from the eclipse workspace directory to examine there are no irrecognizable codes. [解决办法] 是不是设置下系统环境变量哦!估计系统识别不了UTF-8 [解决办法] utf8是世界通用的 [解决办法] LZ你那个字符串在控制台能正常显示?你系统编码都是utf-8啊? [解决办法] logger.info(str); 日志文件的字符集设置了么?这个也要设置成utf-8,否则就算你是以utf-8保存的,打开后显示的还是乱码 [解决办法] 换台电脑试试,实在找不到问题那就有可能是系统的原因 [解决办法]