本文介绍了如何显示不同语言的字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为显示不同languages​​.How preparing示例应用程序中使用区域设置的Uni code,以显示不同语言的字符。请指导我要显示不同的语言。

  StringBuilder的SB =新的StringBuilder();
        sb.append(\\ nChinese:\\ n \\ u54be);
        tv.setText(sb.toString());


解决方案

您应该EN code你的中国字符转换成UTF-8,在这之后一切都将正常工作,如:

 中的InputStream;
    的OutputStream出来;
    //夸夸其谈
    从=GB2312字符串; //中国大陆codePAGE
    字符串=UTF8; // Android的编码
    读者R =新的BufferedReader(新的InputStreamReader(中,来自));
    作家W =新的BufferedWriter(新OutputStreamWriter(出去,));
    //读取和写入夸夸其谈

I am preparing sample application for display different languages.How to display different language characters using locale or Unicode. Please guide me for display different languages.

StringBuilder sb = new StringBuilder();
        sb.append("\nChinese:\n\u54be");
        tv.setText(sb.toString());
解决方案

You should encode your chinese characters into UTF-8, after that everything will work, like:

    InputStream in;
    OutputStream out;
    //blah-blah
    String from="GB2312"; //chinese mainland codepage
    String to="UTF8"; //Android encoding
    Reader r=new BufferedReader(new InputStreamReader(in, from));
    Writer w=new BufferedWriter(new OutputStreamWriter(out, to));
    //read and write blah-blah

这篇关于如何显示不同语言的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 20:58