json_encode() json_decode() working with UTF-8

Working with different locale is very important now a days. But to work with different languages you face some problems – like all of a sudden some function will not work like it supposed to. For instance json_decode/json_encode. The problem is not with the functions cause in php manual they said it works with utf
This function only works with UTF-8 encoded data.
So all you have to do is add the nex line in php code.

header('Content-Type: text/html; charset=utf-8');

Pretty sweet huh.

About Zakir Hyder

This entry was written by .

21. May 2011 by Zakir Hyder
Categories: PHP, Web Development | Tags: , , , | Comments

Comments

  1. […] json_encode() json_decode() working with UTF-8 Sunday, May 22, 2011 1:04 AM Working with different locale is very important now a days. But to work with different languages you face some problems – like all of a sudden some function will not work like it supposed to. For instance json_decode/json_encode. The problem is not with the functions cause in php manual they said it works with utf […] […]