In pre-3.0 Python, unicode strings must be explicitly specified as u'some string'. Otherwise, it is treated as ASCII.
2010/6/4 Ken <[email protected]>: > About web.py > -- > > $def with(job) > $ title = job.name_cn + job.name + '招聘' > $:render.header(title) > > <type 'exceptions.UnicodeDecodeError'> at /jobs/detail-1 > ('ascii', "title = job.name_cn + job.name + '\xe6\x8b\x9b\xe8\x81\x98'", 34, > 35, 'ordinal not in range(128)') > > is this webpy's problem? > and I try to do like this: > > title = this_job.name_cn + this_job.name + '招聘' > return render.job.view(this_job, title) > > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 56: > ordinal not in range(128) > > and then: > title = this_job.name_cn + this_job.name + u'招聘' > > It is OK. > > why? > -- > 百才招聘(baicai.com).产品部 > Email: [email protected] > Gtalk: [email protected] > twitter.com/qichangxing > http://blog.hi0791.com > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > -- Branko Vukelić [email protected] [email protected] Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
