Skip to content

Commit

Permalink
Merge pull request #597 from phil-davis/remove-utf8_encode
Browse files Browse the repository at this point in the history
Remove utf8_encode
  • Loading branch information
phil-davis committed Oct 9, 2022
2 parents bc48391 + f41f276 commit 8157443
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions lib/Parser/MimeDir.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,8 @@ protected function readProperty(string $line)
switch (strtolower($charset)) {
case 'utf-8':
break;
case 'iso-8859-1':
$property['value'] = utf8_encode($property['value']);
break;
case 'windows-1252':
case 'iso-8859-1':
$property['value'] = mb_convert_encoding($property['value'], 'UTF-8', $charset);
break;
default:
Expand Down
3 changes: 2 additions & 1 deletion tests/VObject/StringUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ public function testUTF8ControlChar(): void

public function testConvertToUTF8nonUTF8(): void
{
// 0xBF is an ASCII upside-down question mark
$string = StringUtil::convertToUTF8(chr(0xBF));

$this->assertEquals(utf8_encode(chr(0xBF)), $string);
$this->assertEquals(mb_convert_encoding(chr(0xBF), 'UTF-8', 'ISO-8859-1'), $string);
}

public function testConvertToUTF8IsUTF8(): void
Expand Down

0 comments on commit 8157443

Please sign in to comment.