diff --git a/composer.json b/composer.json index 36ae0bc2d..23181c0e7 100644 --- a/composer.json +++ b/composer.json @@ -40,6 +40,7 @@ "ext-gd": "*", "ext-hash": "*", "ext-iconv": "*", + "ext-intl": "*", "ext-json": "*", "ext-mbstring": "*", "ext-pcre": "*", diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index cd9c17e77..d80bec87d 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -236,7 +236,9 @@ class ContentProxy return $rawText; } - return iconv('UTF-8', 'UTF-8//IGNORE', $rawText); + mb_substitute_character('none'); + + return mb_convert_encoding($rawText, 'UTF-8', 'UTF-8'); } /** diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 54304fc50..6a953ff8b 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -527,6 +527,8 @@ class EntriesExport */ private function getSanitizedFilename() { - return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $this->title)); + $transliterator = \Transliterator::createFromRules(':: Any-Latin; :: Latin-ASCII; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC;', \Transliterator::FORWARD); + + return preg_replace('/[^A-Za-z0-9\- \']/', '', $transliterator->transliterate($this->title)); } } diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index 58931f20d..41b995efa 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php @@ -347,6 +347,8 @@ class ExportControllerTest extends WallabagCoreTestCase private function getSanitizedFilename($title) { - return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $title)); + $transliterator = \Transliterator::createFromRules(':: Any-Latin; :: Latin-ASCII; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC;', \Transliterator::FORWARD); + + return preg_replace('/[^A-Za-z0-9\- \']/', '', $transliterator->transliterate($title)); } } diff --git a/var/SymfonyRequirements.php b/var/SymfonyRequirements.php index 4a1fcc621..c1c530775 100644 --- a/var/SymfonyRequirements.php +++ b/var/SymfonyRequirements.php @@ -455,12 +455,6 @@ class SymfonyRequirements extends RequirementCollection ); } - $this->addRequirement( - function_exists('iconv'), - 'iconv() must be available', - 'Install and enable the iconv extension.' - ); - $this->addRequirement( function_exists('json_encode'), 'json_encode() must be available',