[Tutor] unicode, utf-8 problem again

Dinesh B Vadhia dineshbvadhia at hotmail.com
Thu Jun 4 20:36:56 CEST 2009


That was very useful - thanks!  Hopefully, I'm  "all Unicode" now.



From: wesley chun 
Sent: Thursday, June 04, 2009 10:45 AM
To: Dinesh B Vadhia ; tutor at python.org 
Subject: Re: [Tutor] unicode, utf-8 problem again


>>  But, I still get this error:
>>  Traceback (most recent call last):
>> ...
>> UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in
>> position 76: ordinal not in range(128)
>>  What am I missing?
>
> Take a read through http://evanjones.ca/python-utf8.html which will give you
> insight as to how you should be reading and processing your files.


in a similar vein, i wrote a shorter blog post awhile ago that focuses
specifically on string processing:
http://wesc.livejournal.com/1743.html ... in it, i also describe the
correct way of thinking about strings in these contexts... the
difference between a string that represents data vs. a "string" which
is made up of various bytes, as in binary files.

hope this helps!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090604/e604220b/attachment.htm>


More information about the Tutor mailing list