0

我的 Django 版本是 1.5a1 和 Python 版本: 3.2.3

我得到一个

UnicodeEncodeError 'ascii' codec can't encode character '\xe3' in position 1: ordinal not in range(128)

使用 html 片段:

<input name="test" value="S&#227;o Paulo" type="submit" />

我的html:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta content="text/html; charset=utf-8" http-equiv="content-type">

我找不到为什么 Django 在创建 django.http.HttpRequest 实例并将其提供给我的 python 视图之前将 html 输入转换为 ascii。

4

0 回答 0