From 723d04eef1c5d51472627ea9efba639affe0661b Mon Sep 17 00:00:00 2001 From: Denis Demesmaeker Date: Fri, 14 Dec 2007 15:09:09 +0000 Subject: only transform latin into unicode if wanted, ie for search.ch but not for utf8 sites --- itjs.class | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'itjs.class') diff --git a/itjs.class b/itjs.class index a040d79..73b2b5f 100644 --- a/itjs.class +++ b/itjs.class @@ -87,7 +87,9 @@ function encode($values) else if (!is_array($value)) { $quote = (strval(intval($value)) === strval($value)) ? "" : '"'; - $result .= $quote . preg_replace('/([\xa0-\xff])/e', 'sprintf("\\u%04x", ord("\\1"))', strtr($value, array("\0" => '\\0', '"' => '\\"', ""<\\/", "\n" => '\\n', "\r" => '\\r', "\t" => '\\t', "\\" => '\\\\'))) . $quote; + $string = strtr($value, array("\0" => '\\0', '"' => '\\"', ""<\\/", "\n" => '\\n', "\r" => '\\r', "\t" => '\\t', "\\" => '\\\\')); + $string = $GLOBALS['itjs_defaultconfig']['latin2unicode'] ? preg_replace('/([\xa0-\xff])/e', 'sprintf("\\u%04x", ord("\\1"))', $string) : $string; + $result .= $quote . $string . $quote; } else $result .= itjs::encode($value); -- cgit v1.2.3