宇筱博客

  • 解决办法
  • 学无止境
  • 记录时光
  • 百宝箱
宇筱博客
点滴记忆,汇聚成海。
  1. 首页

  2. Warning: Undefined array key 0 in /www/wwwroot/www.timeit.cn/wp-content/themes/kratos-4.3.2/single.php on line 30

    Warning: Attempt to read property "term_id" on null in /www/wwwroot/www.timeit.cn/wp-content/themes/kratos-4.3.2/single.php on line 30

    Warning: Undefined property: WP_Error::$term_id in /www/wwwroot/www.timeit.cn/wp-content/themes/kratos-4.3.2/single.php on line 35

    Warning: Undefined property: WP_Error::$name in /www/wwwroot/www.timeit.cn/wp-content/themes/kratos-4.3.2/single.php on line 37

    Warning: Undefined property: WP_Error::$parent in /www/wwwroot/www.timeit.cn/wp-content/themes/kratos-4.3.2/single.php on line 38
  3. 正文

ResourceBundle中文乱码

2022年6月10日 1300点热度 0人点赞 0条评论

一、乱码原因

java中properties配置文件默认的编码为:ISO-8859-1,是不支持中文的,所以会乱码

二、解决方法

1) 对字符串进行转码

ResourceBundle bundle = ResourceBundle.getBundle("配置文件名");
String valueCN = new String(bundle.getString("key").getBytes("ISO-8859-1"), "UTF8");

2)将配置文件拷出,使用记事本打开另存为UTF8格式,然后拷贝到工程中覆盖源文件

3)将IDE的所有文件编码均设置成默认UTF8,则以后在读取的时候即可正常读取中文。

原文链接:https://blog.csdn.net/qq_21033663/article/details/78067983

标签: 暂无
最后更新:2022年6月10日

小渔民

这个人很懒,什么都没留下

点赞

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2025 宇筱博客. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备15017825号-2