I am receiving data from JSON in arabic using UTF8 encoding
“\u0639\u0644\u0649”
when displaying it in textview its converted to “علي”
How I can get UTF8 back from this arabic text, assuming that I get arabic text input from keyboard
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Strings are always in Unicode, only byte arrays have an encoding.
Your initial statement makes little sense. You are taking a String that contains three Arabic characters and converting it to a byte array in the default encoding, then converting these bytes back to a String assuming UTF-8 encoding.
I see no benefits in this over
string = "\u0639\u0644\u0649". If you need the bytes that represent this string in UTF-8 encoding, you can callstring.getBytes("UTF-8"), but it’s more likely that your communications library will take a string and let you specify the encoding somehow.