The confusion on python encoding
- by zhangzhong
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?