On Fri, Feb 18, 2011 at 11:40 AM, tom z <maillist....@gmail.com> wrote:
> Hi all~ > My script can't work.I've changed my defaultencoding from 'ascii' to > 'utf-8',but Python also raises a 'UnicodeEncodeError' error. > > the error likes this: > > >>> s=u'La Pe\xf1a' > >>>print s > UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in > position 5: ... > >>> s=u'La Pe\xf1a' >>> print s.encode('utf-8') La Peña ? or use smart_str from django ? By the way did you lift that example from Dive Into Python ? > > And in my script, there're many 'print' statements.So SOS~~~~ > what should i do??? > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- Low Kian Seong Senior Software Manager Logistics Consulting Asia M: +6 012 3736874 • T: +60 3 7729 9386 • F: +60 3 7729 7386 www.logisticsconsulting.asia China • India • Indonesia • Malaysia • Philippines • Singapore • Thailand • Vietnam
-- http://mail.python.org/mailman/listinfo/python-list