如何在谷歌应用程序引擎中发送一个包含字符串的字符串中的变量,如:õá? [英] How to receive variables in a post in google app engine that contains string with chars like: õ á?

查看:94
本文介绍了如何在谷歌应用程序引擎中发送一个包含字符串的字符串中的变量,如:õá?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


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

//添加ã:问题是sdafsaã应该是你的sdafsaã。在字符串前面加上u。现在它的工作原理



然后我得到这个

  main.py ,line 85,in post 

subject =sss+ name +sdafsa,
UnicodeDecodeError:'ascii'编解码器无法解码位置36中的字节0xc3:ordinal不在范围(128)

可能有像õó这样的字符。



有关详细信息:



代码运行工人(之前的代码)
的名称是从数据存储区收到,并包含õ和ó等字符。

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

谢谢

解决方案

尝试阅读一些关于unicode在Python中的工作原理:





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


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

// added ã: the problem was that "sdafsaã" should be u"sdafsaã". with a "u" before the string. and now it works

then i get this

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)

the might have chars like õ ó and something like that.

for more details:

the code to run the worker(the code before) the name is the one that is received from the datastore and contains chars like õ and ó...

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

thanks

解决方案

Try reading a little about how unicode works in Python:

Also, make sure you're running Python 2.5 if you are seeing this error on the development server.

这篇关于如何在谷歌应用程序引擎中发送一个包含字符串的字符串中的变量,如:õá?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆