Reputation: 2727
I am a bit confused why the standard server settings here are giving back the wrong encoding format. On my local machine everything works fine: An CMS backend displays the current month as a string in German and for 03 (March) it returns 'Mär'.
On the server it returns "M�r" back. I know that this is caused while output ISO format in UTF-8, without encoding it (utf8_encode).
<?php
setlocale(LC_ALL,"de_DE");
echo var_dump((strftime('%b', strtotime('2007-03-01'))));
// Output -> string(3) "M�r"
How to change the server settings, that PHP uses UTF-8 and not the ISO format for dates? I cannot use utf8_encode function because it's the CMS which uses PHP strftime and strtotime function.
the default server php.ini already include default_charset = 'UTF-8'
in my htaccess I included AddDefaultCharset UTF-8
Upvotes: 1
Views: 475
Reputation: 2727
Thanks to @apokryfos who sent me to the right direction. Like in the docs mentioned the function strftime() use the locales installed in your system (linux).
...the result will use the iso-8859-1 charset even if you have all your system, files and configuration options in UTF-8...
In the config of my CMS a had to revert that line:
setlocale(LC_ALL, 'de_DE');
to explicitly use UTF-8 version
setlocale(LC_ALL, 'de_DE.utf8');
Upvotes: 1