From 960b387c66c0126f862e21d5c2b56fa17e399b75 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 18 Jan 2018 18:43:40 +0100 Subject: Normalize combining diaeresis to umlaut in it::any2utf8() --- tests/it.t | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/it.t b/tests/it.t index 22826a6..0da8768 100755 --- a/tests/it.t +++ b/tests/it.t @@ -414,6 +414,16 @@ is(it::any2utf8(array("foo", array(utf8_decode("bär")))), array("foo", array("b is(it::any2utf8(array(1, true, false, null)), array(1, true, false, null), "any2utf8 should leave types alone"); is(it::any2utf8(array(utf8_decode('Müller') => utf8_decode('Müller'))), array('Müller' => 'Müller'), "it::any2utf8 latin1 keys"); +is(it::any2utf8("\xc2\xad"), "", "it::any2utf8 remove soft hyphens"); + +foreach ([ 'a' => 'ä', 'e' => 'ë', 'i' => 'ï', 'o' => 'ö', 'u' => 'ü' ] as $src => $dst) +{ + is(it::any2utf8("$src\xcc\x88"), $dst, "it::any2utf8 normalize combining diaeresis $dst to umlaut code $dst"); + $src = mb_strtoupper($src); + $dst = mb_strtoupper($dst); + is(it::any2utf8("$src\xcc\x88"), $dst, "it::any2utf8 normalize combining diaeresis $dst to umlaut code $dst"); +} + foreach (array($dummy, false, true, null, 1, "a", "Ä", "/", array()) as $var) is(it::json_decode(it::json_encode($var)), $var); -- cgit v1.2.3