NutzCN Logo
问答 从配置文件中获取的值中文显示乱码
发布于 2866天前 作者 一叶孤舟 1826 次浏览 复制 上一个帖子 下一个帖子
标签:
配置文件中的值
busiSystem=啊

@Test
public void Test3(){
PropertiesProxy a=new PropertiesProxy(true,"etc/");
LOG.info(a.get("busiSystem"));
}
日志
2017-02-16 18:36:47,921 INFO [main] ErrorResourceLocation
- [loc=D:\Program%20Files\eclipse-64\configuration\org.eclipse.osgi\362\0.cp]not exist
2017-02-16 18:36:47,922 INFO [main] ErrorResourceLocation
- [loc=D:\Program%20Files\eclipse-64\configuration\org.eclipse.osgi\361\0.cp]not exist
2017-02-16 18:36:48,699 DEBUG [main] Scans
- Locations for Scans:
[Dir[path=D:\Users\fei_tao\eclipse-busisysExplore\nwims-busiSysExplore], Jar[path=D:\Program%20Files\maven\maven-tools\repository\org\nutz\nutz\1.r.60\nutz-1.r.60.jar], ErrorResourceLocation [loc=D:\Program%20Files\eclipse-64\configuration\org.eclipse.osgi\362\0.cp], ErrorResourceLocation [loc=D:\Program%20Files\eclipse-64\configuration\org.eclipse.osgi\361\0.cp], Dir[path=D:\Users\fei_tao\eclipse-busisysExplore\nwims-busiSysExplore\target\test-classes], Dir[path=D:\Users\fei_tao\eclipse-busisysExplore\nwims-busiSysExplore\target\classes], Jar[path=D:\Program Files\maven\maven-tools\repository\org\nutz\nutz\1.r.60\nutz-1.r.60.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\com\oracle\ojdbc6\11.2.0.4.0\ojdbc6-11.2.0.4.0.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\apache\logging\log4j\log4j-api\2.3\log4j-api-2.3.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\apache\logging\log4j\log4j-core\2.3\log4j-core-2.3.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\apache\logging\log4j\log4j-1.2-api\2.3\log4j-1.2-api-2.3.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\redis\clients\jedis\2.7.3\jedis-2.7.3.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\apache\commons\commons-pool2\2.3\commons-pool2-2.3.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\net\sf\json-lib\json-lib\2.4\json-lib-2.4-jdk15.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\commons-beanutils\commons-beanutils\1.8.0\commons-beanutils-1.8.0.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\commons-lang\commons-lang\2.5\commons-lang-2.5.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\net\sf\ezmorph\ezmorph\1.0.6\ezmorph-1.0.6.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\net\sourceforge\htmlunit\htmlunit\2.15\htmlunit-2.15.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\xalan\xalan\2.7.1\xalan-2.7.1.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\xalan\serializer\2.7.1\serializer-2.7.1.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\apache\httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\apache\httpcomponents\httpmime\4.3.3\httpmime-4.3.3.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\net\sourceforge\htmlunit\htmlunit-core-js\2.15\htmlunit-core-js-2.15.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\xerces\xercesImpl\2.11.0\xercesImpl-2.11.0.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\net\sourceforge\nekohtml\nekohtml\1.9.21\nekohtml-1.9.21.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\net\sourceforge\cssparser\cssparser\0.9.14\cssparser-0.9.14.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\w3c\css\sac\1.3\sac-1.3.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\commons-io\commons-io\2.4\commons-io-2.4.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\eclipse\jetty\jetty-websocket\8.1.15.v20140411\jetty-websocket-8.1.15.v20140411.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\eclipse\jetty\jetty-util\8.1.15.v20140411\jetty-util-8.1.15.v20140411.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\eclipse\jetty\jetty-io\8.1.15.v20140411\jetty-io-8.1.15.v20140411.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\eclipse\jetty\jetty-http\8.1.15.v20140411\jetty-http-8.1.15.v20140411.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\junit\junit\4.11\junit-4.11.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar], Jar[path=D:\Program Files\maven\maven-tools\repository\com\alibaba\druid\1.0.14\druid-1.0.14.jar], Jar[path=D:\Program Files\Java\jdk1.7\jdk1.7.0_80\lib\jconsole.jar], Jar[path=D:\Program Files\Java\jdk1.7\jdk1.7.0_80\lib\tools.jar], Dir[path=D:\Program Files\eclipse-64\configuration\org.eclipse.osgi\362\0.cp], Dir[path=D:\Program Files\eclipse-64\configuration\org.eclipse.osgi\361\0.cp]]
2017-02-16 18:36:48,715 DEBUG [main] Scans
- Found 8 resource by src( etc/ ) , regex( ^.+[.]properties$ )
2017-02-16 18:36:48,717 INFO [main] URLAccessTest
- \u554a

为什么会出现这种情况呢,我程序和配置文件编码都是utf8

5 回复

这不是乱码,是被ide转义了,禁用转义就好了

我是用的eclipse,怎么禁止转义呢?

把文件编码设置为utf8,删掉原本的内容重新输入

eclipse默认会设置成iso,需要手工设置一下

好的,谢谢,我已经解决这问题了。

添加回复
请先登陆
回到顶部