How to use UTF-8 encoding in Android? - android

I am working on an French Android App, where the Accents like é, ê, â, etc.... are displaying like Symbols, which is fetched for an XML Link. How do I fix this to display the Characters in French assents?

Read UTF-8 XML file in Java – (SAX Parser)
http://www.mkyong.com/java/how-to-read-utf-8-xml-file-in-java-sax-parser/
Post UTF-8 encoded data to server loses certain characters

Related

Characters broken in React Native with Arabic and Persian Language on Android axios (XMLHttpRequest)

Is there anyone has this problem?
With Arabic and Persian language,
I am using axios. And axios using XmlHttpRequest on react-native.
There is no problem with iphone.
But on android, The characters are broken. Not only those Arabic or Persian language but also other all JSON parsed data characters.
I am using application/json for request, response.
But I can see correct data on iphone and web.
Only on android react native.
What is the problem??
Do I have to process something on the server??
Is it because some ambiguous character ? Like RTL or some special charater code in Arabic or Persian language??
I can't find the reason....
Anyone could help me?
What we found out that when typing Arabic rn fetch blob thinks that text is invalid utf8. That is why it tries to send it as base64. So, in response you need to parse base64 text using Buffer or pako.

Encoding JSON to support UTF-8 characters in an android app

I'm trying to display utf-8 character in a ListView in my android app, but what appears is series of question mark????? This is what the output looks like:
[{"ImageID":"1","ItemID":"Item1","ItemID_AM":"????
???","ImagePath":"http:\/\/10.0.2.2\/android\/Pagination\/pics\/pic_a.png"},{"ImageID":"2","ItemID":"Item2","ItemID_AM":"????
????","ImagePath":"http:\/\/10.0.2.2\/android\/Pagination\/pics\/pic_b.png"},...
I already used: header('content-type: application/json; charset=utf-8');
But nothing changed. Can someone help please?
Thanks.
Java strings use Unicode and the JSON strings are UTF-8 encoded. Most likely, you must convert the UTF-8 JSON to Unicode.
Search: java string utf8, for example How to convert Strings to and from UTF8 byte arrays in Java
The easiest way though, would be to let an appropriate JSON library do the decoding. Maybe org.json - Android or How to parse JSON in Android is of help.
Update:
Maybe everything is fine and it is just the font not capable of displaying the needed characters. If this is the case, the solution to the problem would be to install an appropriate font.

Displaying portuguese characters Android

I'm developing an Android app and when it was suposed to write words like "não" or "cabeça", with characters with "~" or "ç" for example, it writes "ã" or "ç". I already checked source files encoding and it is UTF-8.
Looks like UTF8 interpreted as ISO-8859-x.
In theory, you could supply the javac compiler -encoding UTF-8 on the command line but that would be the wrong solution.
Instead, move all your user-facing strings to an XML resource file. In there unicode character encoding works out of the box.
Further reading: http://developer.android.com/guide/topics/resources/string-resource.html

Italian characters in android

I just got my app strings translated to italian but having issues in displaying them on android device.
For example, one of the word is "velocità", on the device the last character à is shown as junk character.
Any pointers on how can I resolve it. The above word is present in the raw-it folder in a .txt file.
I assume you have the txt file not encoded as utf-8. Right click on the file in Eclipse and then properties. Set it to UTF-8. (You might need to copy the text into it again to make the characters appear ok).
UTF8 encoding supports foreign language characters. Try using UTF8 encoding. if that doesnt work then the problemmight be because of the font used.Good Luck.

How do I display Greek characters in Android?

How do I display Greek characters in Android?
Android has full Unicode support and displaying Greek characters should be very easy. In your strings.xml file you can use Greek characters and these will be displayed correctly. Of course you need to save your file in UTF-8 format.

Categories

Resources