From e46ba2c9075ec95d31ed2f6210d3650dc6df10f9 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 12 Apr 2019 11:36:20 -0700 Subject: [PATCH] Fix illegal encoding for MacRomanEncoding With Mac in the from encoding, would get the following error: `mb_convert_encoding(): Illegal character encoding specified`. Fixes https://github.com/smalot/pdfparser/issues/229 --- src/Smalot/PdfParser/Element.php | 3 --- src/Smalot/PdfParser/Font.php | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Smalot/PdfParser/Element.php b/src/Smalot/PdfParser/Element.php index 801dade5..805a0c51 100644 --- a/src/Smalot/PdfParser/Element.php +++ b/src/Smalot/PdfParser/Element.php @@ -51,9 +51,6 @@ class Element */ protected $document = null; - /** - * @var mixed - */ protected $value = null; /** diff --git a/src/Smalot/PdfParser/Font.php b/src/Smalot/PdfParser/Font.php index bcb21cdc..3f825b5d 100644 --- a/src/Smalot/PdfParser/Font.php +++ b/src/Smalot/PdfParser/Font.php @@ -483,7 +483,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; } @@ -496,7 +496,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'); }