<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sun, 19 May 2013 21:57:18 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Pablo Viquez' Blog: How to use json_encode with ISO-8859-1 data '" Part2]]></title>
      <guid>http://www.phpdeveloper.org/news/12979</guid>
      <link>http://www.phpdeveloper.org/news/12979</link>
      <description><![CDATA[<p>
As he mentioned in <a href="http://www.phpdeveloper.org/news/12906">a previous entry</a> on his blog, <i>Pablo Viquez</i> found a few issues with character encoding and the <a href="http://php.net/json_encode">json_encode</a> function. He revisits this in <a href="http://www.pabloviquez.com/2009/07/json-iso-8859-1-and-utf-8-%E2%80%93-part2/">a second look</a> at getting it to cooperate with ISO-8859-1 data.
</p>
<blockquote>
One solution that I did, in order to preserve the character set was to encode the data before using the json_encode function to use just A-Z, a-z and 0-9 characters, instead of sending text with accents or symbols. One encoding that fits perfectly in this schema, is Base64 Content-Transfer-Encoding. (see base 64 explanation below) This leads me to the solution: Encode the ISO-8859-1 using base64 and decoded in the client using JavaScript.
</blockquote>
<p>
He includes both a code example for his solution and <a href="http://www.pabloviquez.com/demo_files/Encoding-JSON.zip">downloadable code</a> for you to try it out yourself. 
</p>]]></description>
      <pubDate>Mon, 03 Aug 2009 07:57:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Pablo Viquez's Blog: JSON, ISO 8859-1 and UTF-8 - Part]]></title>
      <guid>http://www.phpdeveloper.org/news/12906</guid>
      <link>http://www.phpdeveloper.org/news/12906</link>
      <description><![CDATA[<p>
After spotting some null values in a few of his form fields following an Ajax request, <i>Pablo Viquez</i> decided to track down his issue:
</p>
<blockquote>
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!
</blockquote>
<p>
His issue stemmed from the character encoding of the string being passed into <a href="http://php.net/json_encode">json_encode</a> (in this case, UTF-8) was coming from a PHP script saved in a page encoded as ISO-8859-1. You can <a href="http://www.pabloviquez.com/demo_files/Encoding-JSON.zip">download the files</a> he's come up with to illustrate the point.
</p>]]></description>
      <pubDate>Mon, 20 Jul 2009 12:42:36 -0500</pubDate>
    </item>
  </channel>
</rss>
