json_encode fails on double byte UTF-8
| From: | Bruce R Quimby | Date: | Mon, 08 Jul 2024 19:19:33 +0000 |
| Subject: | json_encode fails on double byte UTF-8 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-328455@lists.php.net to get a copy of this message | ||
I just got back from a trip to Switzerland and found that json_encode() is not handling 2-byte
UTF-8. The ü in Zürich causes json_encode to fail. ü is a legitimate UTF-8 double byte
character. If I run the string through mb_convert_encoding($str,"UTF-8","UTF-8”)
the character will be converted to a ‘?’ and json_encode will succeed. Any help is
appreciated.
Bruce Quimby
bquimby1@icloud.com