diff options
| author | Urban Müller | 2012-05-23 16:15:06 +0000 | 
|---|---|---|
| committer | Urban Müller | 2012-05-23 16:15:06 +0000 | 
| commit | c5bad6e1c65bd27c56baf5ab8c4955deb260f429 (patch) | |
| tree | 43b581a39c016217d99ae3d8b58f1f1e1be5b721 | |
| parent | 96fc37a9417759262c2b39fc49c2684b3f34f544 (diff) | |
| download | itools-c5bad6e1c65bd27c56baf5ab8c4955deb260f429.tar.gz itools-c5bad6e1c65bd27c56baf5ab8c4955deb260f429.tar.bz2 itools-c5bad6e1c65bd27c56baf5ab8c4955deb260f429.zip | |
handle triple (and more) encoding
| -rw-r--r-- | it.class | 4 | 
1 files changed, 2 insertions, 2 deletions
| @@ -426,8 +426,8 @@ function any2utf8($value, $errmsg = "")  	{  		if (grapheme_strlen($value) === null)  			list($value, $error) = array(utf8_encode($value), utf8_encode("$errmsg: incorrect utf8-encoding. input=" . trim($value))); -		if (preg_match('/\xc3\x83\xc2([\xbc\xa9\xa4\xb6\xa8\xa2\xa0\xb4\xaa\xa7\x84\xab\xae\x9c\xaf\x96\xb2\xbb\xb9\x9f])/', $value)) -			list($value, $error) = array(preg_replace('/\xc3\x83\xc2([\xbc\xa9\xa4\xb6\xa8\xa2\xa0\xb4\xaa\xa7\x84\xab\xae\x9c\xaf\x96\xb2\xbb\xb9\x9f])/', "\xc3\$1", $value), utf8_encode("$errmsg: double utf8-encoding. input=" . trim($value))); +		if (preg_match('/\xc3[\x82\x83]\xc2[\x82\x83\xbc\xa9\xa4\xb6\xa8\xa2\xa0\xb4\xaa\xa7\x84\xab\xae\x9c\xaf\x96\xb2\xbb\xb9\x9f]/', $value)) +			list($value, $error) = array(it::any2utf8(preg_replace_callback('/\xc3[\x82\x83]\xc2[\x82\x83\xbc\xa9\xa4\xb6\xa8\xa2\xa0\xb4\xaa\xa7\x84\xab\xae\x9c\xaf\x96\xb2\xbb\xb9\x9f]/', function($m) {return utf8_decode($m[0]);}, $value)), "$errmsg: double utf8-encoding. input=" . trim($value));  		if ($error && $errmsg)  			it::error(array('title' => $error, 'skipfiles' => "it_html"));  	} |