5 Mart 2014 Çarşamba

How to solve special character problem (like Turkish, Japannese etc) that occurs when return a result set as JSON

How to solve  special character problem (like Turkish, Japannese  etc) that occurs when return a result set as  JSON?
You have special charachter in a resultset, maybe some errors occurs when it returns as json.
You can solve this problem using following solution. The function will convert only string data. Else this, won't  be converted

4 yorum:

osman homek dedi ki...

iconv(mb_detect_encoding($text, mb_detect_order(), true), "UTF-8", $text);

if you would you like to use this one for the issue..

Selçuk Yavuz dedi ki...

How you create your JSON output ?

If you can do your JSON objects manually ( like with string builder ) do you notice Response Encoding ?

Selçuk Yavuz dedi ki...

Did you notice Response Encoding ?

zyhn dedi ki...

Thanks Osman and Selcuk.
My JSON DATA is create from an resultset array.
Osman, This function do this operation all items of resultset automatically. Response Encoding was not enough in our operation.

Thanks a lot.