note 15426 modified in function.strftime by danbrown

From: Date: Sun, 20 Jul 2008 03:48:57 +0000
Subject: note 15426 modified in function.strftime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142091@lists.php.net to get a copy of this message
Note that setting LC_TIME is not enough for some locales under Windows, e.g. Czech, because there are some characters not contained in default (US) character set like '�' (c with hook), '�' (r with hook). If you run Apache as regular application and have set your locale to Czech (ControlPanel/RegionalOptions), there is no problem and 'September' is correctly translated as 'z���', 'Thursday' as '�tvrtek'. But if you run Apache as service, you get 'z�r�', and 'ctvrtek'. To get things work as you expect you must set LC_CTYPE beside LC_TIME, or set LC_ALL. <?php $locale = 'Czech_Czech.1250'; $res = setlocale( 'LC_CTYPE', $locale); //important $res = setlocale( 'LC_TIME', $locale); echo strftime( '%A %m. %B %Y', mktime( 0,0,0,9,6,2001)); ?> --was-- Note that setting LC_TIME is not enough for some locales under Windows, e.g. Czech, because there are some characters not contained in default (US) character set like 'è' (c with hook), 'ø' (r with hook). If you run Apache as regular application and have set your locale to Czech (ControlPanel/RegionalOptions), there is no problem and 'September' is correctly translated as 'záøí', 'Thursday' as 'ètvrtek'. But if you run Apache as service, you get 'zárí', and 'ctvrtek'. To get things work as you expect you must set LC_CTYPE beside LC_TIME, or set LC_ALL. <? $locale = 'Czech_Czech.1250'; $res = setlocale( 'LC_CTYPE', $locale); //important $res = setlocale( 'LC_TIME', $locale); echo strftime( '%A %m. %B %Y', mktime( 0,0,0,9,6,2001)); ?> http://php.net/manual/en/function.strftime.php

« previous php.notes (#142091) next »