我们正在尝试将‘俄语’区域设置添加到Symfony2应用程序中。但是翻译服务不能正确地显示西里尔字母。
以UTF-8编码保存的messages.ru.xliff包含:
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>Hello</source>
<target>Привет</target>
</trans-unit>
</body>
</file>
</xliff>但
echo $this->get('translator')->trans('Hello').'<br>';转储像‘РџСЂРёРІС-С’这样的东西,而不是'Привет‘。但是,messages.xx.xliff格式的ASCII符号可以很好地读取。
发布于 2013-11-22 21:12:13
在html中指定UTF-8字符集即可完成此任务
<meta http-equiv="content-type" content="text/html; charset=UTF-8">https://stackoverflow.com/questions/20130580
复制相似问题