擅长:python、mysql、java
<p>检查要格式化的参数类型,我猜它们是'str',不是'unicode'。
在使用它们之前,对它们进行适当的编码,例如:</p>
<pre><code>url = request.user.get_absolute_url
if isinstance(url, str):
print 'url was str'
a = url.decode('utf-8')
msg = u'Uživatel <a href="{0}">...</a>').format(url)
</code></pre>
<p>(<code>if</code>和{<cd2>}语句仅用于演示目的)
相应地使用其他值。在</p>