在android开发中,有时候会遇到汉字乱码的问题,在这个时候,吧String串加一个编码格式转换,转换成UTF-8的格式就可以了

public static String toUtf8(String str) {
        String result = null;
        try {
            result = new String(str.getBytes("UTF-8"), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return result;
    }

 

相关文章:

  • 2021-07-26
  • 2021-10-07
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-30
  • 2022-12-23
  • 2021-04-11
  • 2021-09-21
相关资源
相似解决方案