In my android app I make a simple toast
Toast.makeText(
parent.getApplicationContext(),
parent.getResources().getIdentifier(result, "string",
parent.getPackageName()), Toast.LENGTH_LONG).show();
This
parent.getResources().getIdentifier(result, "string", parent.getPackageName())
retrieves a string whose name matches result from strings.xml
. I have a strings.xml file for english and german language. The problem is that special chars in german language like Ü Ö Ä are not displayed correctly. They are replaced by a square symbol.
The strings.xml are utf-8 encoded.
Where is the problem and how can I fix it?
ArtWorkAD,
It appears as though your problem is being caused by the fact that the Toast.makeText()
method is not using the correct Charset when pulling your special characters from the resources.
I suggest as a debugging step you pull the string down from the resources independantly and use the
Toast.makeText(Context context, CharSequence text, int duration).show();
overload to render your text. This way you can confirm that the text is what you expect and narrow down your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With