正如我注意到 PHP 的json_encode($array)弄乱了变音符号。\n如果我使用通过 HTTP 传递的 javascript 创建的 JSON更新我的数据库列类型文本,一切看起来都很好。但是当我将JSON创建到PHP中时,某些字符的编码方式很奇怪。
\n我有这个数组;
\n$array = ['M-am \xc3\xaent\xc3\xaelnit ieri cu','fosta mea prof\xc4\x83 de matematic\xc4\x83'];\n\n$text = implode(",",$array); // this looks good in db\n$json = json_encode($array); // this don't and returns error when try to decode later.\nRun Code Online (Sandbox Code Playgroud)\n