mydate.strftime('%x') and cgi script

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Mar 22 07:59:28 CET 2006


In <487tlsFif6m9U1 at news.dfncis.de>, Sibylle Koczian wrote:

>>>I'm writing a cgi script which only needs to run in a small LAN. I tried
>>>to show dates in a reasonable format by using
>>>
>> 
>> That's the web server's locale appropriate date representation then.
>> 
> 
> The web server is on my machine - doesn't it use its regional settings?

The settings are per user and stored in environment variables.  Apache
clears most of them at start.

> I've seen a little more in the meantime:
> 
> xx = locale.setlocale(locale.LC_ALL, '')
> 
> # print HTML header, title, everything up to and including body tag
> 
> print xx
> 
> # print rest of page
> 
> In the cgi script xx is "C" and not "de_DE.utf-8". Looks as if setlocale
> isn't executed.

`setlocale()` is executed but if there are no environment variables (LANG,
LC_*) then the default locale `C` is chosen.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list