title: Encode URL-encoded string into JSON with PHP
body: <p>I have a query string with URL-encoded symbols:</p>
  
  <pre><code>$wm_string = "LMI_MODE=1&amp;LMI_PAYMENT_DESC=%CF%EE%E6%E5%F0%F2%E2%EE%E2%E0%ED%E8%E5+Plan+Z";
  </code></pre>
  
  <p>I need to convert it into JSON with PHP, but <code>json_encode</code> returns an empty string.</p>
  
  <p>Here is my code in PHP:</p>
  
  <pre><code>parse_str($wm_string, $_REQUEST);
  var_dump($_REQUEST);
  echo "JSON:".json_encode($_REQUEST);
  </code></pre>
  
  <p>Here is the result:</p>
  
  <pre><code>array(1) { ["LMI_MODE"]=&gt; string(46) "1?LMI_PAYMENT_DESC=Пожертвование Plan Z Online" } JSON:
  </code></pre>
  
  <p>What should I do?</p>
  
  <p>UPDATE:</p>
  
  <p>The expected result is:</p>
  
  <pre><code>{ 
      "LMI_MODE":1,
      "LMI_PAYMENT_DESC":"Пожертвование Plan Z Online" 
  }
  </code></pre>
  
  <p>UPDATE2:
  The encoding is windows-1251, while <code>json_encode</code> seems to be expecting UTF-8. Is there a way to tell <code>json_encode</code> which encoding it should use while parsing?</p>