Skip to content

Commit

Permalink
Replacement for #238 (Fix illegal encoding for MacRomanEncoding) (#313)
Browse files Browse the repository at this point in the history
* try fix from @daneren2005 (from #238) to fix failing test in PHP 8.0
  • Loading branch information
k00ni authored Jun 26, 2020
1 parent e886687 commit bc4ebf8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Binary file added samples/bugs/Issue229_mac_roman_encoding.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions src/Smalot/PdfParser/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public function decodeContent($text, &$unicode)
$text = $result;

if ($encoding->get('BaseEncoding')->equals('MacRomanEncoding')) {
$text = mb_convert_encoding($text, 'UTF-8', 'Mac');
$text = mb_convert_encoding($text, 'UTF-8', 'ISO-8859-1');

return $text;
}
Expand All @@ -495,7 +495,7 @@ public function decodeContent($text, &$unicode)
if ($this->get('Encoding') instanceof Element &&
$this->get('Encoding')->equals('MacRomanEncoding')
) {
$text = mb_convert_encoding($text, 'UTF-8', 'Mac');
$text = mb_convert_encoding($text, 'UTF-8', 'ISO-8859-1');
} else {
$text = mb_convert_encoding($text, 'UTF-8', 'Windows-1252');
}
Expand Down

0 comments on commit bc4ebf8

Please sign in to comment.