title: Zend form setAttribs with json_encode
body: <p>I have a zend form select element that calls a javascript function onchange. The following:</p>
  
  <pre><code>$element-&gt;setAttribs(array( 'onchange' =&gt; 'toggleSelect(this.value, ' . json_encode($this-&gt;_testData) . ')'));
  </code></pre>
  
  <p>The problem is, both the ZEND onchange and the json_encode use double quotes, so it becomes:</p>
  
  <pre><code>&lt;select onchange="toggleSelect(1, {"foo" : "bar"})"&gt;&lt;/select&gt;
  </code></pre>
  
  <p>Which complains about an invalid property id. I'm thinking it is the double quotes that are causing the problem, but don't know how to fix.</p>