From ae17c5f249a6f8f810bd583ca022d6052d95400e Mon Sep 17 00:00:00 2001 From: Thomas BrĂ¼derli Date: Tue, 28 Aug 2007 07:46:24 +0000 Subject: Some browsers still report invalid chars. Use \uxxxx for non-ascii chars --- itjs.class | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itjs.class b/itjs.class index c0a8ef3..86e9e86 100644 --- a/itjs.class +++ b/itjs.class @@ -72,7 +72,7 @@ function encode($values) else if (!is_array($value)) { $quote = (strval(intval($value)) === strval($value)) ? "" : '"'; - $result .= $quote . preg_replace('/([\xa0-\xff])/e', 'sprintf("\\x%02x", ord("\\1"))', strtr($value, array("\0" => '\\0', '"' => '\\"', ""<\\/", "\n" => '\\n', "\r" => '\\r', "\t" => '\\t', "\\" => '\\\\'))) . $quote; + $result .= $quote . preg_replace('/([\xa0-\xff])/e', 'sprintf("\\u%04x", ord("\\1"))', strtr($value, array("\0" => '\\0', '"' => '\\"', ""<\\/", "\n" => '\\n', "\r" => '\\r', "\t" => '\\t', "\\" => '\\\\'))) . $quote; } else $result .= itjs::encode($value); -- cgit v1.2.3