|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-07-22 22:04 UTC] jani@php.net
[2008-07-22 22:05 UTC] jani@php.net
[2008-07-23 09:11 UTC] neonira at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
Description: ------------ I checked that the file encoding character set for the php source file is UTF-8. So it means, I provide a real UTF-8 entry, and I don't need to use ut8_encode. It seems that accentuated caracters are truncated or not well managed while json-encoding a string. Reproduce code: --------------- <?php setlocale(LC_ALL, "fr"); class CT { var $link; var $str; var $arr; function document() { $this->link = "http://www.neonira.com"; $this->str = "cha?ne avec caract?res accentu?s ... "; $this->arr = array(1, 3, "lala", "123", array ( 'a', 'b', 'c'), 134); } } $c = new CT(); $c->document(); echo json_encode($c); ?> Expected result: ---------------- shell>php ../php/ct.php {"link":"http:\/\/www.neonira.com","str":"cha?ne avec caract?res accentu?s ... ","arr":[1,3,"lala","123",["a","b","c"],134]}shell> Actual result: -------------- shell>{107}php ../php/ct.php {"link":"http:\/\/www.neonira.com","str":"cha","arr":[1,3,"lala","123",["a","b","c"],134]}shell>