mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-01 21:41:05 +00:00
Replace iconv() calls with Transliterator
See https://stackoverflow.com/a/35178027/954513 Closes #5377 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
parent
194c87e363
commit
1608bf5a4e
5 changed files with 10 additions and 9 deletions
|
@ -40,6 +40,7 @@
|
||||||
"ext-gd": "*",
|
"ext-gd": "*",
|
||||||
"ext-hash": "*",
|
"ext-hash": "*",
|
||||||
"ext-iconv": "*",
|
"ext-iconv": "*",
|
||||||
|
"ext-intl": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"ext-pcre": "*",
|
"ext-pcre": "*",
|
||||||
|
|
|
@ -236,7 +236,9 @@ class ContentProxy
|
||||||
return $rawText;
|
return $rawText;
|
||||||
}
|
}
|
||||||
|
|
||||||
return iconv('UTF-8', 'UTF-8//IGNORE', $rawText);
|
mb_substitute_character('none');
|
||||||
|
|
||||||
|
return mb_convert_encoding($rawText, 'UTF-8', 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -527,6 +527,8 @@ class EntriesExport
|
||||||
*/
|
*/
|
||||||
private function getSanitizedFilename()
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,6 +347,8 @@ class ExportControllerTest extends WallabagCoreTestCase
|
||||||
|
|
||||||
private function getSanitizedFilename($title)
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,12 +455,6 @@ class SymfonyRequirements extends RequirementCollection
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addRequirement(
|
|
||||||
function_exists('iconv'),
|
|
||||||
'iconv() must be available',
|
|
||||||
'Install and enable the <strong>iconv</strong> extension.'
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->addRequirement(
|
$this->addRequirement(
|
||||||
function_exists('json_encode'),
|
function_exists('json_encode'),
|
||||||
'json_encode() must be available',
|
'json_encode() must be available',
|
||||||
|
|
Loading…
Reference in a new issue