diff options
author | Urban Müller | 2012-04-24 14:18:21 +0000 |
---|---|---|
committer | Urban Müller | 2012-04-24 14:18:21 +0000 |
commit | 9c523156bbc9d34ff2a16ec3b2c345951fc55287 (patch) | |
tree | b03409e32574aaa76f78aef8158030d6a8cea5d8 /it_html.class | |
parent | 177de5290677a71fe95e5264f1f21fad9cc7c469 (diff) | |
download | itools-9c523156bbc9d34ff2a16ec3b2c345951fc55287.tar.gz itools-9c523156bbc9d34ff2a16ec3b2c345951fc55287.tar.bz2 itools-9c523156bbc9d34ff2a16ec3b2c345951fc55287.zip |
merged it_html::fix_encoding in it::any2utf8
Diffstat (limited to 'it_html.class')
-rw-r--r-- | it_html.class | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/it_html.class b/it_html.class index ed47abd..ece7070 100644 --- a/it_html.class +++ b/it_html.class @@ -258,21 +258,6 @@ function _parse_args($args) } -# internal -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 (preg_match('/\xc3\x83\xc2[\x84\x9c\xa4\xb6\xbc\xa9\xa0]/', $string)) # Double encoded ÄÖÜäöüéà, UTF8SAFE - list($string, $error) = array(utf8_decode($string), utf8_encode("doubly utf8-encoded: " . trim($string))); - - if ($error && !$silent) - it::error(array('title' => $error, 'skipfiles' => "it_html")); - - return $string; -} - - /** * function div($args...) * Return a <div>...</div> element @@ -328,7 +313,7 @@ function _tag($name, $args) $result .= " />$newline"; if ($GLOBALS['debug_utf8check'] && $GLOBALS['it_html']->p['charset'] == "utf-8") - $result = self::fix_encoding($result); + $result = it::any2utf8($result, "error in $name()"); return $result; } @@ -498,7 +483,7 @@ function Q($string) if (preg_match('/[<>&"\x00-\x08\x0a-\x0c\x0e-\x1f\x80-\xff]/', $string)) # WARNING: copy/pasted to _tag() { if ($GLOBALS['debug_utf8check'] && $GLOBALS['it_html']->p['charset'] == "utf-8") - $string = self::fix_encoding($string); + $string = it::any2utf8($string, "error in Q()"); $origstring = $string; $string = @htmlspecialchars($GLOBALS['it_html']->p['charset'] == "iso-8859-1" ? it_html::latinize($string) : $string, ENT_COMPAT, $GLOBALS['it_html']->p['charset']); |