From 02f634189d9a6828876c1bfa2416847f89acba77 Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Wed, 1 Jul 2026 12:01:36 +0200 Subject: [PATCH] fix(util): map ambiguous UConverter charset aliases Map windows-1252 and tis620 to unambiguous ICU names so HordeString charset conversion does not emit PHP warnings. --- src/CharacterSets.php | 2 ++ test/CharacterSetsTest.php | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/CharacterSets.php b/src/CharacterSets.php index 160537f..38b91c0 100644 --- a/src/CharacterSets.php +++ b/src/CharacterSets.php @@ -48,6 +48,8 @@ class CharacterSets 'big5-hkscs' => 'ibm-1375_P100-2008', 'shift_jis' => 'ibm-943_P15A-2003', 'tis-620' => 'windows-874-2000', + 'tis620' => 'windows-874-2000', + 'windows-1252' => 'cp1252', 'windows-1258' => 'cp1258', 'windows-936' => 'windows-936-2000', 'windows-950' => 'windows-950-2000', diff --git a/test/CharacterSetsTest.php b/test/CharacterSetsTest.php index 99cb2d3..bf74bb8 100644 --- a/test/CharacterSetsTest.php +++ b/test/CharacterSetsTest.php @@ -85,6 +85,18 @@ public function testToUConverterWindows1258(): void $this->assertEquals('cp1258', CharacterSets::toUConverter('Windows-1258')); } + public function testToUConverterWindows1252(): void + { + $this->assertEquals('cp1252', CharacterSets::toUConverter('windows-1252')); + $this->assertEquals('cp1252', CharacterSets::toUConverter('Windows-1252')); + } + + public function testToUConverterTis620(): void + { + $this->assertEquals('windows-874-2000', CharacterSets::toUConverter('tis620')); + $this->assertEquals('windows-874-2000', CharacterSets::toUConverter('TIS-620')); + } + public function testToUConverterPreservesUnambiguousCharsets(): void { $this->assertEquals('iso-8859-1', CharacterSets::toUConverter('iso-8859-1'));