From 9c523156bbc9d34ff2a16ec3b2c345951fc55287 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 24 Apr 2012 14:18:21 +0000 Subject: merged it_html::fix_encoding in it::any2utf8 --- it_html.class | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'it_html.class') 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
...
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']); -- cgit v1.2.3