0

Mysql data has some text with unicode inside, like \uXXXX . How can i display that unicode properly in textview

using json_encode($var) in PHP, resulting \\uXXXX in JSON output

Now, Textview displayin unicode as \\uXXXX instead of symbol. How can i display it as unicode symbol in textview.

Sandeep
  • 5
  • 6
  • see http://stackoverflow.com/questions/4522337/unicode-characters-not-displayed-in-textview-settext – Rohit Jun 18 '14 at 09:44
  • Could you not just use `unicodeString.substr(1, unicodeString.length());`? Or does the string have more than just unicode in it? – TMH Jun 18 '14 at 10:37
  • yes its more than one and not in particular position of sting. its para with \\uXXXX in it – Sandeep Jun 18 '14 at 11:18

1 Answers1

0

Open your php file with notpad++, from Encoding menu select "Encode in UTF-8 without BOM" then save your php file.

then send final result like this:

$json = json_encode($data, JSON_UNESCAPED_UNICODE);
header('Content-type: application/json; charset=utf-8');
echo $json;

this way your characters will be exactly the way they are and you won't get them like \uXXXX.

M D P
  • 4,525
  • 2
  • 23
  • 35