diff --git a/src/ICal/ICal.php b/src/ICal/ICal.php index 511b1d7..dfd1b29 100644 --- a/src/ICal/ICal.php +++ b/src/ICal/ICal.php @@ -2472,24 +2472,24 @@ protected function cleanCharacters($input) return strtr( $input, array( - "\xe2\x80\x98" => "'", // ‘ - "\xe2\x80\x99" => "'", // ’ - "\xe2\x80\x9a" => "'", // ‚ - "\xe2\x80\x9b" => "'", // ‛ - "\xe2\x80\x9c" => '"', // “ - "\xe2\x80\x9d" => '"', // ” - "\xe2\x80\x9e" => '"', // „ - "\xe2\x80\x9f" => '"', // ‟ - "\xe2\x80\x93" => '-', // – - "\xe2\x80\x94" => '--', // — - "\xe2\x80\xa6" => '...', // … - chr(145) => "'", // ‘ - chr(146) => "'", // ’ - chr(147) => '"', // “ - chr(148) => '"', // ” - chr(150) => '-', // – - chr(151) => '--', // — - chr(133) => '...', // … + "\xe2\x80\x98" => "'", // ‘ + "\xe2\x80\x99" => "'", // ’ + "\xe2\x80\x9a" => "'", // ‚ + "\xe2\x80\x9b" => "'", // ‛ + "\xe2\x80\x9c" => '"', // “ + "\xe2\x80\x9d" => '"', // ” + "\xe2\x80\x9e" => '"', // „ + "\xe2\x80\x9f" => '"', // ‟ + "\xe2\x80\x93" => '-', // – + "\xe2\x80\x94" => '--', // — + "\xe2\x80\xa6" => '...', // … + $this->mb_chr(145) => "'", // ‘ + $this->mb_chr(146) => "'", // ’ + $this->mb_chr(147) => '"', // “ + $this->mb_chr(148) => '"', // ” + $this->mb_chr(150) => '-', // – + $this->mb_chr(151) => '--', // — + $this->mb_chr(133) => '...', // … ) ); } diff --git a/tests/CleanCharacterTest.php b/tests/CleanCharacterTest.php new file mode 100644 index 0000000..8ceca1b --- /dev/null +++ b/tests/CleanCharacterTest.php @@ -0,0 +1,32 @@ +getMethod($name); + + // < PHP 8.1.0 + $method->setAccessible(true); + + return $method; + } + + public function testCleanCharacters() + { + $ical = new ICal(); + $input = 'Test with emoji 🔴👍🏻'; + + self::assertSame( + self::getMethod('cleanCharacters')->invokeArgs($ical, array($input)), + $input + ); + } +}