locale.CODESET / different in python shell and scripts

"Martin v. Löwis" martin at v.loewis.de
Thu Apr 29 16:14:23 EDT 2004


Nuff Said wrote:
> Both Python versions give me 'ANSI_X3.4-1968' when I run a script
> with 'print locale.nl_langinfo(locale.CODESET)'. 
>   When I execute the same command in an interactive Python shell, 
> I get the (correct) 'UTF-8'. 

PLEASE invoke

locale.setlocale(locale.LC_ALL, "")

before invoking nl_langinfo. Different C libraries behave differently
in their nl_langinfo responses if setlocale hasn't been called.

Regards,
Martin




More information about the Python-list mailing list