我的谷歌应用引擎中出现“服务器遇到错误但无法完成您的请求”错误:
我的app.yaml:
application: myapp
version: 2
runtime: python
api_version: 1
builtins:
- remote_api: on
- datastore_admin: on
handlers:
- url: /AJAX
script: main.py
- url: /emailtrigger
script: main.py
- url: /emailworker
script: main.py
- url: /
static_files: static_files/index.html
upload: static_files
- url: /
static_dir: static_files
日志中的错误:
<type 'exceptions.SyntaxError'>: Non-ASCII character '\xc3' in file /base/data/home/apps/myapp/2.349019521625775975/main.py on line 77, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details (main.py, line 77)
我有一个字符串:ã; main.py是utf-8编码的
答案 0 :(得分:2)
# - - 编码:utf-8 - -
尝试将字符串转换为unicode
self.response.out.write(UNICODE( “A”, “UTF-8”))