[dev] Tree and special chars

Joel Vandal jvandal at infoteck.qc.ca
Wed Apr 26 11:41:13 PDT 2006


Hi Duck,
> I have problems with Javascript Tree rendering when a node name contains non 
> US characters. I located the problem in the JSON. Cheking the output seems 
> that the serialization crop the strings at the position where the "special" 
> character is. Example attached.
>   
I've got a similar problem with french accent where character are truncated.

Ex. Général => Génér
Téléphonie => Téléphon
Réseau => Résea

I have check and the only way to fix the problem, without broke other 
scripts that use the TreeView, is with this patch for 
framework/Serialize/JSON.php

--- JSON.php 22 Nov 2005 13:50:05 -0000 1.10
+++ JSON.php 26 Apr 2006 18:36:31 -0000
@@ -138,7 +138,7 @@
             // Iterate over every character in the string, escaping with a
             // slash or encoding to UTF-8 code points where necessary.
             $ascii = '';
-            for ($c = 0; $c < $strlen; ++$c) {
+            for ($c = 0; $c < strlen($var); ++$c) {
                 $char = String::substr($var, $c, 1, 'utf-8');
                 if (strlen($char) == 1) {
                     $ascii .= str_replace($needles, $replacements, $char);



--
Joel Vandal, CTO
ScopServ Inc.
http://www.scopserv.com/


More information about the dev mailing list