title: Why does the PHP json_encode function convert UTF-8 strings to hexadecimal entities?
body: <p>I have a PHP script that deals with a wide variety of languages. Unfortunately, whenever I try to use <code>json_encode</code>, any Unicode output is converted to hexadecimal entities. Is this the expected behavior? Is there any way to convert the output to UTF-8 characters?</p>
  
  <p>Here's an example of what I'm seeing:</p>
  
  <p>INPUT</p>
  
  <pre><code>echo $text;
  </code></pre>
  
  <p>OUTPUT</p>
  
  <pre><code>База данни грешка.
  </code></pre>
  
  <p>INPUT</p>
  
  <pre><code>json_encode($text);
  </code></pre>
  
  <p>OUTPUT</p>
  
  <pre><code>"\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u0438 \u0433\u0440\u0435\u0448\u043a\u0430."
  </code></pre>