当前位置: 移动技术网 > IT编程>开发语言>Java > Java读取properties配置文件时,出现中文乱码的解决方法

Java读取properties配置文件时,出现中文乱码的解决方法

2019年07月22日  | 移动技术网IT编程  | 我要评论

如下所示:

public static string getconfig(string key) {
    properties pros = new properties();
    string value = "";
    try {
      pros.load(new inputstreamreader(object.class.getresourceasstream("/properties.properties"), "utf-8"));
      value = pros.get(key).tostring();
    } catch (ioexception e) {
      log.error(e.getmessage());
    }
    return value;
  }

以上就是小编为大家带来的java读取properties配置文件时,出现中文乱码的解决方法全部内容了,希望大家多多支持移动技术网~

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网