且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

json_encode(): 参数中的 UTF-8 序列无效

更新时间:2021-12-19 06:09:23

好像符号是 Å,但由于数据由不应公开的姓氏组成,所以只显示了第一个字母并且它只是由 $lastname[0] 完成的,这对于多字节字符串来说是错误的,并导致了整个麻烦.将其更改为 mb_substr($lastname, 0, 1) - 就像一个魅力.

Seems like the symbol was Å, but since data consists of surnames that shouldn't be public, only first letter was shown and it was done by just $lastname[0], which is wrong for multibyte strings and caused the whole hassle. Changed it to mb_substr($lastname, 0, 1) - works like a charm.