I’ve been working on a German language site that uses PHP’s date() function to output formatted dates in various places. I had set character encoding to UTF-8 - the only sensible choice header(‘Content-Type: text/html; charset=UTF-8’);
but then using setlocale
rendered month names where an umlaut was necessary with the dreaded � the secret, not explicitly mentioned in the PHP manual was:
If you want the locale to be used in date formatting, use strfromtime() rather than date().