From d9efa28dfa0f8d113e7159362198886383760237 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 16 May 2013 12:30:30 +0000 Subject: no longer omit it_html in backtrace, renamed $errmsg --- it.class | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/it.class b/it.class index 0d4cc06..07ca19f 100644 --- a/it.class +++ b/it.class @@ -408,25 +408,25 @@ static function grep($pattern, $array, $p = array()) /** * Convert string to utf8 if it was not already utf-8 before. Also handles double encoding * @param $value String or array to convert - * @param $errmsg Error message to output if anything needed to be done + * @param $errprefix Error message to output if anything needed to be done * @return Same string in utf-8 encoding */ -static function any2utf8($value, $errmsg = "") +static function any2utf8($value, $errprefix = "") { if (is_array($value)) { foreach ($value as $idx => $v) if (is_string($v) || is_array($v)) - $value[$idx] = self::any2utf8($v, $errmsg); + $value[$idx] = self::any2utf8($v, $errprefix); } else if (is_string($value)) { if (grapheme_strlen($value) === null) - list($value, $error) = array(utf8_encode($value), utf8_encode("$errmsg: incorrect utf8-encoding. input=" . trim($value))); + list($value, $error) = array(utf8_encode($value), utf8_encode("$errprefix: incorrect 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")); + 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)), "$errprefix: double utf8-encoding. input=" . trim($value)); + if ($error && $errprefix) + it::error(array('title' => $error)); } return $value; -- cgit v1.2.3