0

We are trying to add 'russian' locale to Symfony2 application. But the translation service does not bring up cyrillic characters correctly.

messages.ru.xliff saved with UTF-8 encoding contains:

<?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>

but

echo $this->get('translator')->trans('Hello').'<br>';

dumps something like 'РџСЂРёРІС–С‚' instead of 'Привет'. However ASCII symbols form messages.xx.xliff are fetched well.

ChatCloud
  • 1,152
  • 2
  • 8
  • 22
  • Are you sure, that html document itself is in UTF-8 (check your browser settings) ? Using this service ( http://2cyr.com/decode/?lang=ru ) I tried to decode `РџСЂРёРІС–С‚` into any meaningful russian word and it doesn't work, because it is multiple encoding or just corrupted input. – Anton Babenko Nov 21 '13 at 21:07
  • 1
    Thank you, Anton, that's it. UTF-8 charset was not specified in the html so current browser settings were used. – ChatCloud Nov 21 '13 at 21:46

1 Answers1

0

Specifying UTF-8 charset in html does the job

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
ChatCloud
  • 1,152
  • 2
  • 8
  • 22