1

My response function in my API written in php is like:

 function response(array $response)
{
    header('Content-Type: application/json');
    echo json_encode($response);
    exit;
}

BUT my server returns data like:

{"items":[{"feed_id":2,"title":"\u062d\u0631\u0642 \u0643\u0644\u064a \u0644\u0644\u062d\u0648\u

where :

\u062d\u0631\u0642 \u0643\u0644\u064a \u0644\u0644\u062d\u0648\u

is of no meaning, i thought this issue is due to character encoding so i have added:

  header('Content-Type: application/json; charset=utf-8');

but still getting the same response.

Any idea on how to fix this issue using squareup okhttp:2.2.0 in android?

Fshamri
  • 1,346
  • 4
  • 17
  • 32
  • 3
    `\u062d\u0631\u0642 \u0643\u0644\u064a \u0644\u0644\u062d\u0648` these are utf-8 characters, not no meaning: https://mothereff.in/utf-8#-1B%20CDJ%20DD-H – Daniel Cheung Mar 05 '15 at 12:49
  • Pretty sure those are arabic: http://www.fileformat.info/info/unicode/char/0631/index.htm – divaka Mar 05 '15 at 13:19
  • Yes, it arabic characters – Fshamri Mar 05 '15 at 13:26
  • Dive in here: http://stackoverflow.com/questions/11145681/how-to-convert-a-string-with-unicode-encoding-to-a-string-of-letters Hope this helps! – divaka Mar 05 '15 at 13:28

0 Answers0