Unicode problem

Michael Hudson mwh at python.net
Thu Mar 21 08:15:36 EST 2002


Duncan Booth <duncan at NOSPAMrcp.co.uk> writes:

> gargravarr at whoever.com wrote in news:3c98faad.27124282 at news.tiscali.no:
> 
> >>if you don't tell Python what 8-bit encoding you want
> >>to use for a Unicode string, Python will assume ASCII.
> > 
> > How do I tell Python what 8-bit encoding I want to use ? Can I tell
> > Python so I don't have to use encode?
> 
> site.py uses sys.setdefaultencoding to set the default encoding but it then 
> does 'del sys.setdefaultencoding' to stop anyone else messing with it.
> 
> Your options (entirely at your own risk):
>   Edit site.py to select a different default encoding.
>   Edit site.py to remove the line that deletes sys.setdefaultencoding
>   OR to recover a reference to setdefaultencoding:
>      import sys; reload(sys)

or: write a sitecustomize.py

Cheers,
M.

-- 
  > so python will fork if activestate starts polluting it?
  I find it more relevant to speculate on whether Python would fork
  if the merpeople start invading our cities riding on the backs of 
  giant king crabs.                 -- Brian Quinlan, comp.lang.python



More information about the Python-list mailing list