From 4d1b92f1d4e9f2f80d04b452246399cb40bb543d Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Tue, 12 Mar 2019 17:57:48 +0100 Subject: Normalize to FORM_C in any2utf8 --- it.class | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index 937cde7..714ffc4 100644 --- a/it.class +++ b/it.class @@ -533,8 +533,7 @@ static function any2utf8($value, $errprefix = "") if (preg_match('/\xef\xb7[\x90-\xaf]|\xef\xbf[\xbe\xbf]/', $value)) list($value, $error) = array(preg_replace('/\xef\xb7[\x90-\xaf]|\xef\xbf[\xbe\xbf]/', " ", $value), "forbidden utf-8 character. input=$value"); $value = preg_replace('/\xc2\xad/', '', $value); # Kill invisible soft hyphens - if (preg_match('/\xcc\x88/', $value)) # Normalize combining diaeresis to umlaut - $value = strtr($value, [ "a\xcc\x88" => 'ä', "A\xcc\x88" => 'Ä', "e\xcc\x88" => 'ë', "E\xcc\x88" => 'Ë', "i\xcc\x88" => 'ï', "I\xcc\x88" => 'Ï', "o\xcc\x88" => 'ö', "O\xcc\x88" => 'Ö', "u\xcc\x88" => 'ü', "U\xcc\x88" => 'Ü' ]); + $value = normalizer_normalize($value, Normalizer::FORM_C); if ($error && $errprefix) it::error(array('title' => "$errprefix: " . trim($error))); } -- cgit v1.2.3