classification
Title: datetime.strftime and locale.getdefaultlocale conflict on Windows ?
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jwfang
Priority: normal Keywords:

Created on 2012-10-30 12:10 by jwfang, last changed 2012-10-30 12:22 by jwfang. This issue is now closed.

Messages (2)
msg174203 - (view) Author: jamesf (jwfang) Date: 2012-10-30 12:10
on windows(windows 7), python 2.7.3 compiled with VS 2008 and code page "cp936".

locale.getdefaultlocale call Win32 API GetACP and return "cp936",
but a small test program return "C" from 'getlocale' CRT function.
I am not sure if this behaviour is expected or bug?

It seems that datetime.strftime call the CRT function strftime to
do the real work, since the CRT locale is C, it use that to format
locale dependent directive like "%B" and "%x"; 
But since locale.getdefaultlocale return "cp936", so i expect
datetime.strftime to return locale formatted string.
msg174204 - (view) Author: jamesf (jwfang) Date: 2012-10-30 12:22
i just found that locale.getlocale does return (None, None),
maybe defaultlocale just return the DEFAULT, which is the hints.

i will use locale.setlocale in my app, so close this issue.
History
Date User Action Args
2012-10-30 12:22:03jwfangsetstatus: open -> closed

messages: + msg174204
2012-10-30 12:10:57jwfangcreate