Проблема веб-службы вывода php-json с символами utf-8 (греческая)

Я новичок в PHP и JSON, и на основе учебника я сделал простой веб-сервис, который возвращает содержимое таблицы mysql db.

Выходные данные представлены как в XML, так и в JSON, а набор символов базы данных – UTF-8. моя проблема в том, что некоторые поля содержат греческие символы и не отображаются корректно в формате вывода JSON (в XML все в порядке). Любая идея, что может быть неправильным?

Файл PHP следующий:

<?php /* require the place_name_en as the parameter */ /* soak in the passed variable or set our own */ $number_of_places = isset($_GET['num']) ? intval($_GET['num']) : 1; //10 is the default $format = strtolower($_GET['format']) == 'json' ? 'json' : 'xml'; //xml is the default /* connect to the db */ $link = mysql_connect('xxx','xxx','xxx') or die('Cannot connect to the DB'); mysql_select_db('foodbar',$link) or die('Cannot select the DB'); mysql_set_charset('utf8',$link); mysql_query('set names utf8'); /* grab the posts from the db */ $query = 'SELECT * FROM test'; $result = mysql_query($query,$link) or die('Errant query: '.$query); /* create one master array of the records */ $posts = array(); if(mysql_num_rows($result)) { while($place = mysql_fetch_assoc($result)) { $places[] = array('place'=>$place); } } if($format == 'json') { /* output in json format */ header('Content-type: application/json'); echo json_encode(array('places'=>$places)); } else { /* output in xml format */ header('Content-type: text/xml; charset=utf-8'); echo '<?xml version="1.0" encoding="utf-8"?>'; echo '<places>'; foreach($places as $index => $place) { if(is_array($place)) { foreach($place as $key => $value) { echo '<',$key,'>'; if(is_array($value)) { foreach($value as $tag => $val) { /*echo '<',$tag,'>',htmlentities($val,ENT_QUOTES,"utf-8"),'</',$tag,'>';*/ echo '<',$tag,'>',$val,'</',$tag,'>'; } } echo '</',$key,'>'; } } } echo '</places>'; } @mysql_close($link); ?> 

Здесь вы можете протестировать выход xml.

Но когда возвращается формат json, возникает проблема с греческими символами. они выглядят так:

\ U03b4 \ u03b4 \ u03b5 \ u03c3 \ u03c3 \ u03b4 \ u03b4 \ u03c6

Есть идеи? Заранее спасибо!

Настройки PS DB: MySQL charset: UTF-8 Unicode (utf8) и сопоставление соединений MySQL: utf_8_unicode_ci