Unicode problem
Duncan Booth
duncan at NOSPAMrcp.co.uk
Thu Mar 21 04:14:30 EST 2002
More information about the Python-list mailing list
Thu Mar 21 04:14:30 EST 2002
- Previous message (by thread): Unicode problem
- Next message (by thread): Unicode problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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) I have no idea whether it is safe to call setdefaultencoding multiple times, although a quick play with the interpreter didn't reveal any massive problems. I also have no idea what effect reload(sys) may have on anything. I didn't even know you could reload a builtin module until I tried it. -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
- Previous message (by thread): Unicode problem
- Next message (by thread): Unicode problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list