locale.CODESET / different in python shell and scripts

Michael Hudson mwh at python.net
Wed Apr 28 07:24:49 EDT 2004


"Martin v. Löwis" <martin at v.loewis.de> writes:

> Nuff Said wrote:
> > When I type the following code in the interactive python shell,
> > I get 'UTF-8'; but if I put the code into a Python script and
> > run the script - in the same terminal on my Linux box in which
> > I opened the python shell before -, I get 'ANSI_X3.4-1968'.
> > How does that come?
> 
> Because, for some reason, locale.setlocale() is called in your
> interactive startup, but not in the normal startup.
> 
> It is uncertain why this happens - setlocale is not normally
> called automatically; not even in interactive mode. Perhaps
> you have created your own startup file?

readline calls setlocale() iirc.

Cheers,
mwh

-- 
  Not only does the English Language borrow words from other
  languages, it sometimes chases them down dark alleys, hits
  them over the head, and goes through their pockets.   -- Eddy Peters



More information about the Python-list mailing list