diff options
author | Denis Demesmaeker | 2007-12-14 15:09:09 +0000 |
---|---|---|
committer | Denis Demesmaeker | 2007-12-14 15:09:09 +0000 |
commit | 723d04eef1c5d51472627ea9efba639affe0661b (patch) | |
tree | 112aad53229fecfe88be6bf58fb4cd58c3fb7f50 /itjs.class | |
parent | 82d030f3e020266f914799b034d9fbe2dd3f577f (diff) | |
download | itools-723d04eef1c5d51472627ea9efba639affe0661b.tar.gz itools-723d04eef1c5d51472627ea9efba639affe0661b.tar.bz2 itools-723d04eef1c5d51472627ea9efba639affe0661b.zip |
only transform latin into unicode if wanted, ie for search.ch but not for utf8 sites
Diffstat (limited to 'itjs.class')
-rw-r--r-- | itjs.class | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |