Json_encode 字符集问题

2022-01-07 00:00:00 json character-encoding localization php

当我使用 json_encode 对我的多语言字符串进行编码时,它也会改变特殊字符.我应该怎么做才能保持它们不变.

When I use json_encode to encode my multi lingual strings , It also changes special characters.What should I do to keep them same .

例如

<?
echo json_encode(array('şüğçö'));

它返回类似 ["u015fu00fcu011fu00e7u00f6"]

It returns something like ["u015fu00fcu011fu00e7u00f6"]

但我想要 ["şüğçö"]

But I want ["şüğçö"]

推荐答案

试试看:

<?
echo json_encode(array('şüğçö'), JSON_UNESCAPED_UNICODE);

相关文章