diff options
author | Tobi823 <Tobi823@users.noreply.github.com> | 2018-09-19 13:59:07 +0200 |
---|---|---|
committer | Tobi823 <Tobi823@users.noreply.github.com> | 2018-09-21 13:15:00 +0200 |
commit | c01d9532920ec5a298bb347dbb83a078d36d4841 (patch) | |
tree | 01cd827cd8202bd5ff1c0be4779d5aa28b78e268 /src/Wallabag | |
parent | f80f16dfc858ec90da76daacd405b0cfdaa32f74 (diff) | |
download | wallabag-c01d9532920ec5a298bb347dbb83a078d36d4841.tar.gz wallabag-c01d9532920ec5a298bb347dbb83a078d36d4841.tar.zst wallabag-c01d9532920ec5a298bb347dbb83a078d36d4841.zip |
Add tests for logic
Try to translate the title of a PDF from UTF-8 (then UTF-16BE, then WINDOWS-1252) to UTF-8
Diffstat (limited to 'src/Wallabag')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/ContentProxy.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index fab05268..50090100 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -90,8 +90,8 @@ class ContentProxy | |||
90 | * @return string (maybe contains invalid UTF-8 character) | 90 | * @return string (maybe contains invalid UTF-8 character) |
91 | */ | 91 | */ |
92 | private function convertPdfEncodingToUTF8($title) { | 92 | private function convertPdfEncodingToUTF8($title) { |
93 | // first try UTF-16 (then UTF-8) because its easier to detect its present/absence | 93 | // first try UTF-8 because its easier to detect its present/absence |
94 | foreach (array('UTF-16BE', 'UTF-16LE', 'UTF-8', 'WINDOWS-1252') as $encoding) { | 94 | foreach (array('UTF-8', 'UTF-16BE', 'WINDOWS-1252') as $encoding) { |
95 | if (mb_check_encoding($title, $encoding)) { | 95 | if (mb_check_encoding($title, $encoding)) { |
96 | return mb_convert_encoding($title, 'UTF-8', $encoding); | 96 | return mb_convert_encoding($title, 'UTF-8', $encoding); |
97 | } | 97 | } |