Update: The problem was that I was using a custom font and this didn't
contain these special chars. There was actually no difference between
xml/programmatically, I was testing incorrectly.
Am Mittwoch, 17. Juli 2013 12:58:43 UTC+2 schrieb user123:
>
> I have a strange issue with vietnamese translations. They're stored in
> strings.vi file, in the app.
>
> The translations which are attached to TextView directly in the layout
> files display correctly, but if I get them programmatically:
> `getString(R.string.foo)`, then some of the vietnamese special chars
> display question marks (with squares).
>
> I checked:
>
> - Translations file saved in UTF-8
> - Workspace uses UTF-8
>
> I also tried:
>
> textView.setText(new String(getString(R.string.foo).getBytes(),
> "UTF-8"));
>
> But nothing helps, still get these question marks.
>
> I tried also setting ISO-8859-1 in getBytes - basically because I found
> this in some other thread but it doesn't make really sense, since the
> characters should be saved in UTF-8 (and otherwise, I don't know how they
> are stored).
>
> textView.setText(new
> String(getString(R.string.foo).getBytes("ISO-8859-1"), "UTF-8"));
>
> This changed the result a bit, got bigger questions marks but still
> showing incorrectly.
>
>
> I also tried changing the enconding of the xml file to UTF-16, or use
> UTF-16 in getString, but then everything was displayed in something I
> believe is Chinese.
>
>
> Any ideas? Thanks.
>
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.