Re: Re: json_encode() behavior and the browser

From: Date: Wed, 01 Sep 2010 14:00:14 +0000
Subject: Re: Re: json_encode() behavior and the browser
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-307812@lists.php.net to get a copy of this message
> http://www.w3.org/TR/html4/charset.html > I hope it can help you. > PS: json_decode works only in utf8. I understand charsets. I understand the difference between the charsets. What I don't understand is how json_encode() is taking the *exact same input* and behaving differently (breaking in one case, working in another) depending on the browser being used. And taking your statement that json_encode() works only in utf-8 as a given, how can I guard against the different behaviors on the backend, where json_encode() is getting executed. Should I do some kind of header sniffing prior to every call to json_encode() and massage the data accordingly depending on what I find? That seems somewhat excessive. But based on what you are saying and based on what I'm witnessing, it seems like there is no other way around that. thnx, Christoph

« previous php.general (#307812) next »