python - 包含分号的 POST 在分号后被截断

标签 python google-app-engine python-2.7 webapp2

如果我有一个 POST 参数

d={"data": "<span>hello</span>"}

这是一个 JSON 字符串,它工作正常并且 request.POST.get('d') 包含完整的字符串。但是如果我把它改成

d = {"data": "<span>hel;lo</span>"}
print (request.POST.get('d')) #prints '{"data": "<span>hel'

出于某种原因,分号后的任何内容都被截断了。我可以确认这不是 Javascript 执行此操作,因为我曾经使用完全相同的 javascript 代码发布到能够检索数据的 PHP API。自从转向 Python 和 webapp2,我遇到了这个问题。

最佳答案

通过 encodeURIComponent() 运行您的字符串。然后将对截断的组件进行编码。之后在检索需要解码的数据时。

关于python - 包含分号的 POST 在分号后被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13393768/

相关文章:

python - scikit数据集存储在计算机的哪里?

python - GQLQuery 检索空结果集

python - 谷歌应用引擎 : upload throws "TemplateDoesNotExist: index.html" error

android - 从工作站外部访问在 Eclipse 中运行的网络服务器

python - 在 python 中查找字符串的有效方法

python - 索引错误: list index out of range for the caesar cipher

python - 通过Python实现Oauth2.0授权refresh token(谷歌API服务创建)

python - 如何在 Python 中定义后缀函数?

带有异步 def 的 python asyncio add_done_callback

python - Python中子类的函数返回错误