News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pablo Viquez's Blog:
JSON, ISO 8859-1 and UTF-8 - Part
July 20, 2009 @ 12:42:36

After spotting some null values in a few of his form fields following an Ajax request, Pablo Viquez decided to track down his issue:

While I was looking at some AJAX calls, I started to have a problem, for some reason, when I tried to query a JSON service I did using JQuery, the result was null for some fields. Going a little deeper, I notice that the records from the DB were OK, and the JavaScript was OK to, so what was the problem? The JSON Encode!

His issue stemmed from the character encoding of the string being passed into json_encode (in this case, UTF-8) was coming from a PHP script saved in a page encoded as ISO-8859-1. You can download the files he's come up with to illustrate the point.

0 comments voice your opinion now!
json encode utf8 iso88591 jsonencode


blog comments powered by Disqus

Similar Posts

Utah PHP Users Group: PHP and JSON

Slawek Lukasiewicz's Blog: New Features in PHP 5.4 - JSON Extension & header_register_callback

PHPMaster.com: Generate QR Codes in PHP

Vinu Thomas' Blog: Modifying your MySQL databases to be UTF-8 compliant

Ahmed Shreef's Blog: iconv misunderstands UTF-16 strings with no BOM


Community Events





Don't see your event here?
Let us know!


language list series configure application laravel code api project bugfix library release wordpress interview threedevsandamaybe framework developer introduction podcast community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework