The confusion on python encoding
Posted
by zhangzhong
on Stack Overflow
See other posts from Stack Overflow
or by zhangzhong
Published on 2010-05-25T11:14:59Z
Indexed on
2010/05/25
11:21 UTC
Read the original article
Hit count: 331
I retrieved the data encoded in big5 from database,and I want to send the data as email of html content, the code is like this:
html += """<tr><td>"""
html += """unicode(rs[0], 'big5')""" # rs[0] is data encoded in big5
I run the script, but the error raised: UnicodeDecodeError: 'ascii' codec can't decode byte......
However, I tried the code in interactive python command line, there are no errors raised, could you give me the clue?
© Stack Overflow or respective owner