![](/img/trans.png)
[英]how to TextView.setText(List<String>object) like TextView.setText(array[index]) settext from List
[英]String Encoding TextView.setText()
在TextView中设置文本时,无法正确解释字符'ù'。 这是我的代码:
TextView tv = new TextView(context);
String s;
byte[] bytes;
s = "dgseùeT41ù";
bytes = s.getBytes("ISO-8859-1");
tv.setText(new String(bytes));
我不知道我要去哪里。 谢谢你的支持
您已使用"ISO-8859-1"
但Java默认使用UTF-8
因此在创建字符串时定义字符集
大小写映射基于Character类指定的Unicode标准版本,并且String表示UTF-16格式的字符串
所以
bytes = s.getBytes("ISO-8859-1");
tv.setText(new String(bytes,"ISO-8859-1"));
或根本不使用它
bytes = s.getBytes();
tv.setText(new String(bytes));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.