【问题标题】:read unicode from file and display text从文件中读取 unicode 并显示文本
【发布时间】:2011-05-22 15:01:55
【问题描述】:

如何从文件中读取unicode字符并在textview中显示对应的字母。例如文件包含以下内容

\u0BAB\u0BCD\u0BAA

【问题讨论】:

    标签: java android unicode


    【解决方案1】:

    这应该让你开始:

    String str = "\\u0BAB\\u0BCD\\u0BAA";
    StringBuilder sb = new StringBuilder();
    
    for (int i = 0; i < str.length(); i += 6) {
        String chStr = str.substring(i+2, i+6);
        sb.append((char) Integer.parseInt(chStr, 16));
    }
    
    System.out.println("Result: " + sb.toString());
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-19
      • 1970-01-01
      相关资源
      最近更新 更多