diff options
author | Christian Schneider | 2012-03-28 14:51:57 +0000 |
---|---|---|
committer | Christian Schneider | 2012-03-28 14:51:57 +0000 |
commit | 07c7a6f9c568fc1d1e20eb75c733ca314e36005e (patch) | |
tree | 01a6e238e384e25d8dda2dcb25eaf398d2870737 /it_html.class | |
parent | a7ac24d9f9698ff0a1d42268d79f74cd21f70eb4 (diff) | |
download | itools-07c7a6f9c568fc1d1e20eb75c733ca314e36005e.tar.gz itools-07c7a6f9c568fc1d1e20eb75c733ca314e36005e.tar.bz2 itools-07c7a6f9c568fc1d1e20eb75c733ca314e36005e.zip |
Added encoding check to it_dbi, improved encoding check (currently lives in it_html)
Diffstat (limited to 'it_html.class')
-rw-r--r-- | it_html.class | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/it_html.class b/it_html.class index f20c4be..91e3069 100644 --- a/it_html.class +++ b/it_html.class @@ -261,9 +261,9 @@ function _parse_args($args) # internal function fix_encoding($string, $silent = false) { - if (preg_match('/[\x20-\x7f][\x80-\xff][\x20-\x7f]/', $string)) + 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) && utf8_encode(utf8_decode($string)) === $string && htmlspecialchars(utf8_decode($string), ENT_COMPAT, "utf-8") !== "") + else if ($string && preg_match('/[\x80-\xff]/', $string) && grapheme_strlen(utf8_decode($string)) !== null && utf8_encode(utf8_decode($string)) === $string) list($string, $error) = array(utf8_decode($string), utf8_encode("doubly utf8-encoded: " . trim($string))); if ($error && !$silent) |