String Encoding Textview.settext()
while setting text in a TextView, the character 'ù' isn't correctly interpreted. This is my code: TextView tv = new TextView(context); String s; byte[] bytes; s = 'dgseùeT41ù';
Solution 1:
You have used "ISO-8859-1"
but java uses by default UTF-8
so either define the charset while creating string
Case mapping is based on the Unicode Standard version specified by the Character class and A String represents a string in the UTF-16 format
so
bytes = s.getBytes("ISO-8859-1");
tv.setText(newString(bytes,"ISO-8859-1"));
or don't use it at all
bytes = s.getBytes();
tv.setText(newString(bytes));
Post a Comment for "String Encoding Textview.settext()"