private function XliffFileLoader::utf8ToCharset in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/translation/Loader/XliffFileLoader.php \Symfony\Component\Translation\Loader\XliffFileLoader::utf8ToCharset()
Convert a UTF8 string to the specified encoding.
Parameters
string $content String to decode:
string $encoding Target encoding:
Return value
string
1 call to XliffFileLoader::utf8ToCharset()
- XliffFileLoader::load in vendor/
symfony/ translation/ Loader/ XliffFileLoader.php - Loads a locale.
File
- vendor/
symfony/ translation/ Loader/ XliffFileLoader.php, line 93
Class
- XliffFileLoader
- XliffFileLoader loads translations from XLIFF files.
Namespace
Symfony\Component\Translation\LoaderCode
private function utf8ToCharset($content, $encoding = null) {
if ('UTF-8' !== $encoding && !empty($encoding)) {
if (function_exists('mb_convert_encoding')) {
return mb_convert_encoding($content, $encoding, 'UTF-8');
}
if (function_exists('iconv')) {
return iconv('UTF-8', $encoding, $content);
}
throw new \RuntimeException('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).');
}
return $content;
}