2017-05-27 137 views
0

我在这里有点新手,所以我很抱歉,如果我没有从我读过的早期帖子中得出这个答案。土耳其/ hungrairan /波兰语字母没有正确执行

我把一个文件放在php中。当php文件的URL被执行时,所有东西都能正常工作,除了一些波兰和土耳其字符出现问号(在utf8和unicode中)并且简单地消失并在anicode中变成拉丁字母。

我编辑在写字板和记事本。

我该如何解决这个问题?

谢谢。

function array_utf8_encode($dat) 
{ 
if (is_string($dat)) 
    return utf8_encode($dat); 
if (!is_array($dat)) 
    return $dat; 
$ret = array(); 
foreach ($dat as $i => $d) 
    $ret[$i] = array_utf8_encode($d); 
return $ret; 
} 

header('Content-Type: application/json'); 

// Return the array back to Qualtrics 
print json_encode(array_utf8_encode($returnarray)); 
?> 
+0

请仔细阅读本[如何对提问](HTTP:/ /stackoverflow.com/help/how-to-ask),然后按照指导原则使用其他信息(如代码和错误消息来描述您的编程问题)来优化您的问题。 – thewaywewere

回答

0

听起来像是你可能需要添加json_encode JSON_UNESCAPED_UNICODE选项:

print json_encode(array_utf8_encode($returnarray), JSON_UNESCAPED_UNICODE); 

其他json_encode选项是在:http://php.net/manual/en/json.constants.php