google-app-engine - 如何在 Google 应用引擎中的帖子中接收变量,其中包含带有 : õ á? 等字符的字符串

标签 google-app-engine encoding decoding

email = self.request.get('email')
name = self.request.get('name')
mail.send_mail(sender="myemail", email=email, body=name, subject="sss " + name + "sdafsaã")

//添加了ã:问题是“sdafsaã”应该是u“sdafsaã”。字符串前加一个“u”。现在可以了

然后我明白了

main.py", line 85, in post

subject="sss " + name + "sdafsa",
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 36: ordinal not in range(128)

可能有像 õ ó 之类的字符。

了解更多详情:

运行worker的代码(之前的代码) 该名称是从数据存储区接收的名称,包含 õ 和 ó 等字符...

 taskqueue.add(url='/emailworker', params={'email': e.email, 'name': e.name})

谢谢

最佳答案

尝试阅读一些有关 unicode 在 Python 中如何工作的内容:

此外,如果您在开发服务器上看到此错误,请确保您运行的是 Python 2.5。

关于google-app-engine - 如何在 Google 应用引擎中的帖子中接收变量,其中包含带有 : õ á? 等字符的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5316188/

相关文章:

javascript - javascript 的 Thymeleaf 编码问题(使用 spring mvc)

ruby - 如何解码svg数据uri(不是base64)

java - AppEngine/Java Cron DeadlineExceededException

python + appengine + oauth2 + 谷歌联系人 api

python - 为什么 en-dash 在 Python 中写成 '\xe2\x80\x93'?

java - 如何避免native2ascii UTF编码BOM头?

audio - avcodec_decode_audio4() 中的缓冲区错误

python - python3 上的 UnicodeDecodeError

java - 具有多个服务器实例的 AppEngine JDO 丢失通过 key 获取的实体的事务更新

python - Win 7 上的 Google App Engine : Python 2. 5 和 Python 2.7(64 位)