PhiloNL/laravel-translate

Unicode characters

Closed this issue · 2 comments

Special characters like German ä ö ü ß, but also quotation marks etc. do not work as expected. They either get encoded wrong or escaped, while they should better be turned into html entities or left untouched (escape the single quote only).

Nice package otherwise, thanks for all your work.

Translations are now converted to entities by default.
You can use the --no-entities option in case you don't want the translation to be converted.
Let me know if this resolves all the issues. Thanks! 😄

Thanks, that fixes the quotes problem. Although for special characters I stumbled accross another issue.
Problem is that the CLI arguments are encoded according to whatever code page the shell is set to, in my case its cp850. Window's equivalent code page for utf8 is cp65001. which sadly doesn't work well with php-cli.

That said, the only fix I could think of was to add a config setting "console_codepage", set it to "cp850" and add those 2 lines to yor addLine() function.

$codepage = Config::get('translate::console_codepage');
$translation = ($codepage) ? iconv($codepage,"utf-8",$translation): $translation;

To be thorough one should actually convert the "group" argument too, but a reasonable coder should refrain from using special chars in his array keys anyway, so that's prolly not an issue.

Thanks again and have a nice day. :)