Android读取xxx.properties配置文件中文出现乱码解决方法
来源:互联网 发布:阿里云dns解析地址 编辑:程序博客网 时间:2024/05/16 00:29
android读取assets中的配置文件英文没问题,但是中文会出现乱码的问题,前提配置文件已经是utf-8的格式了
出现问题的代码:
@Override public void start() { try { Properties properties = new Properties(); InputStream inputStream = context.getAssets().open("config.properties");、 properties.load(inputStream); myPackage = properties.getProperty("mypackage"); myName = properties.getProperty("myname"); myGitHub = properties.getProperty("mygithub"); myCSDN = properties.getProperty("mycsdn"); } catch (IOException e) { e.printStackTrace(); } }
经过修改后就没有以上的问题了,不要让properties直接去load流文件就可以了
@Override public void start() { try { Properties properties = new Properties(); InputStream inputStream = context.getAssets().open("config.properties"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); properties.load(bufferedReader); myPackage = properties.getProperty("mypackage"); myName = properties.getProperty("myname"); myGitHub = properties.getProperty("mygithub"); myCSDN = properties.getProperty("mycsdn"); } catch (IOException e) { e.printStackTrace(); } }
0 0
- Android读取xxx.properties配置文件中文出现乱码解决方法
- Java读取properties配置文件时,中文乱码解决方法
- Java读取properties配置文件时,中文乱码解决方法 .
- java读取*.properties配置文件时,中文乱码解决方法
- Java读取properties配置文件时,中文乱码解决方法
- Java读取properties配置文件时,中文乱码解决方法
- java程序读取properties配置文件出现中文乱码
- Android Studio中使用properties配置文件出现中文乱码问题
- Java读取中文文件出现乱码解决方法
- 读取java的配置文件.properties出现乱码问题
- java读取properties配置文件,并解决中文乱码
- java读取properties配置文件时中文乱码解决办法
- Springboot解决IDEA读取properties配置文件的中文乱码
- Spring读取properties文件出现乱码的解决方法
- Spring读取properties文件出现乱码的解决方法
- Spring读取properties文件出现乱码的解决方法
- Spring读取properties文件出现乱码的解决方法
- ResourceBundle (读取properties文件及中文乱码解决方法)
- 两张图说明C#Winform为什么没有[design]界面
- 圈圈教你玩usb第一版件软件使用说明
- linux下ant的build.xml脚本
- tesseract安装使用
- JQuery总结
- Android读取xxx.properties配置文件中文出现乱码解决方法
- HBase中的过滤器
- Andriod 第八课----传感器
- 故事会-设计模式-工厂方法
- 为RecyclerView打造简单易用扩展性高的万能适配器
- HTML让文字在图片上显示
- 工具类
- 3 centos 下安装 elastic search 启动的问题
- pycaffe学习之(三):caffenet.py