我有一个Python字符串:这个问题是由•
造成Jinja2的编码来渲染
<p> <a href="http://blog.alexmaccaw.com/how-to-travel-around-the-world-for-a-year">How to travel around the world for a year • Alex MacCaw<span class="small">blog.alexmaccaw.com</span> </a></p>
的 <type 'str'>
,当我尝试使用神社来呈现它。
renderedPage = template.render(starred = the_string_i_mentioned_higher_up)
而与此错误结束:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 125: ordinal not in range(128)
我已经尝试了所有种类的编码和解码,但我总是得到一个类似的错误。
有什么想法?
你怎么'the_string_i_mentioned_higher_up'或者它是如何编码的?你宣布它的字面? –