diff options
author | Urban Müller | 2012-04-10 14:25:32 +0000 |
---|---|---|
committer | Urban Müller | 2012-04-10 14:25:32 +0000 |
commit | 7b603ba54278b493d4b9704353a47cab84d00961 (patch) | |
tree | faa9c55237d97bd964c152e936e46439b2ff5d1a /it_html.class | |
parent | 9f13a3b384785321fbfdd0344e95d58c58bc5086 (diff) | |
download | itools-7b603ba54278b493d4b9704353a47cab84d00961.tar.gz itools-7b603ba54278b493d4b9704353a47cab84d00961.tar.bz2 itools-7b603ba54278b493d4b9704353a47cab84d00961.zip |
simpler double encoding test avoids false positives
Diffstat (limited to 'it_html.class')
-rw-r--r-- | it_html.class | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/it_html.class b/it_html.class index 4c9f3e7..0f18996 100644 --- a/it_html.class +++ b/it_html.class @@ -263,7 +263,7 @@ function fix_encoding($string, $silent = false) { if (grapheme_strlen($string) === null) list($string, $error) = array(utf8_encode($string), utf8_encode("incorrectly utf8-encoded: " . trim($string))); - else if ($string && preg_match('/[\x80-\xff]/', $string) && grapheme_strlen(utf8_decode($string)) !== null && utf8_encode(utf8_decode($string)) === $string) + else if (preg_match('/\xc3\x83(\xc2\x84|\xc2\x9c|\xc2\xa4|\xc2\xb6|\xc2\xbc|\xc2\xa9|\xc2\xa0)/', $string)) # Double encoded ÄÖÜäöüéà, UTF8SAFE list($string, $error) = array(utf8_decode($string), utf8_encode("doubly utf8-encoded: " . trim($string))); if ($error && !$silent) |