mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-27 17:28:39 +00:00
Add tests for logic
Try to translate the title of a PDF from UTF-8 (then UTF-16BE, then WINDOWS-1252) to UTF-8
This commit is contained in:
parent
f80f16dfc8
commit
c01d953292
2 changed files with 238 additions and 2 deletions
|
@ -90,8 +90,8 @@ class ContentProxy
|
|||
* @return string (maybe contains invalid UTF-8 character)
|
||||
*/
|
||||
private function convertPdfEncodingToUTF8($title) {
|
||||
// first try UTF-16 (then UTF-8) because its easier to detect its present/absence
|
||||
foreach (array('UTF-16BE', 'UTF-16LE', 'UTF-8', 'WINDOWS-1252') as $encoding) {
|
||||
// first try UTF-8 because its easier to detect its present/absence
|
||||
foreach (array('UTF-8', 'UTF-16BE', 'WINDOWS-1252') as $encoding) {
|
||||
if (mb_check_encoding($title, $encoding)) {
|
||||
return mb_convert_encoding($title, 'UTF-8', $encoding);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue