0

我知道这已经被问过很多次了,我可能应该对这个问题投反对票,但我尝试了很多事情都没有成功。

我的应用程序正在生产中。

我收到此错误:

2012-10-03 15:08:29.385 'ascii' codec can't encode character u'\xed' in position 2: ordinal not in range(128) Traceback (most recent call last): File "/base/python27_runtim
E 2012-10-03 15:08:29.447 Traceback (most recent call last):
E 2012-10-03 15:08:29.447 File "/base/python27_runtime/python27_dist/lib/python2.7/wsgiref/handlers.py", line 85, in run
E 2012-10-03 15:08:29.447 self.result = application(self.environ, self.start_response)
E 2012-10-03 15:08:29.447 File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1519, in __call__
E 2012-10-03 15:08:29.447 response = self._internal_error(e)
E 2012-10-03 15:08:29.447 File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
E 2012-10-03 15:08:29.447 rv = self.handle_exception(request, response, e)
E 2012-10-03 15:08:29.447 File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
E 2012-10-03 15:08:29.447 rv = self.router.dispatch(request, response)
E 2012-10-03 15:08:29.447 File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
E 2012-10-03 15:08:29.447 return route.handler_adapter(request, response)
E 2012-10-03 15:08:29.447 File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
E 2012-10-03 15:08:29.447 return handler.dispatch()
E 2012-10-03 15:08:29.447 File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
E 2012-10-03 15:08:29.447 return self.handle_exception(e, self.app.debug)
E 2012-10-03 15:08:29.447 File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
E 2012-10-03 15:08:29.447 return method(*args, **kwargs)
E 2012-10-03 15:08:29.447 File "/base/data/home/apps/s~sigs-enlanube/1.362200469572800834/SIGS.py", line 231, in post
E 2012-10-03 15:08:29.447 descripcion = str(self.request.get('txtDescripcion')).decode('utf-8')
E 2012-10-03 15:08:29.447 UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 2: ordinal not in range(128)

这是堆栈跟踪中提到的行: 在此处输入图像描述

我正在使用jinja2。这是在文本区域中输入的文本。

在此处输入图像描述

这是页面的开始方式: 在此处输入图像描述

这是文本区域代码:

在此处输入图像描述

我不明白为什么在生产中会出现此错误,因为在 localhost 中测试时一切正常。

提前致谢。

4

1 回答 1

1

这可能是由于一个错误,请参阅提交多部分/表单数据表单时应用引擎中的编码问题

>>> import quopri
>>> t = unicode(quopri.decodestring('=CD'), 'iso_8859-2')
>>> print t
Í
于 2012-10-05T00:39:06.213 回答