1

我在提交了 utf 字符(测试字符串 'Îñţérñâţîöñåļîžæ†îøñ')的实时站点中收到以下错误:

400 Bad Request

The request entity could not be decoded. The following charsets were attempted: ['utf-8']

Traceback (most recent call last):
  File ".virtual/local/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 648, in respond
    self.body.process()
  File ".virtual/local/lib/python2.7/site-packages/cherrypy/_cpreqbody.py", line 931, in process
    super(RequestBody, self).process()
  File ".virtual/local/lib/python2.7/site-packages/cherrypy/_cpreqbody.py", line 500, in process
    proc(self)
  File ".virtual/local/lib/python2.7/site-packages/cherrypy/_cpreqbody.py", line 153, in process_urlencoded
    "charsets were attempted: %s" % repr(entity.attempt_charsets))
HTTPError: (400, "The request entity could not be decoded. The following charsets were attempted: ['utf-8']")
Powered by CherryPy 3.2.0

我可以使用<form type="POST" accept-charset="utf-16">.

通常,我会在应用程序代码中捕获错误并将它们记录下来或通过电子邮件将它们发送给自己,但这个错误从未到达我在 TurboGears 1.5 上运行的应用程序代码。

关于如何捕捉和记录 CherryPy 生成的错误,其次,为用户提供更好的 404 页面的任何想法?


_cperror.html#unanticipated-errors中列出的错误处理方法 不适用于此类错误(但会引发例如静态文件丢失)

4

0 回答 0