在 appengine 中使用拉丁字符

发布于 2024-09-07 02:22:35 字数 245 浏览 12 评论 0原文

如何在appengine中存储拉丁字符? (例如“peña”)当我想存储它时,我收到此错误:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 2: ordinal not in range(128)

我可以将 Ñ 更改为 N,但是,没有其他更好的方法吗?

如果我对值进行编码,如何再次打印“Peña”?

How can store latin characters in appengine? (e.g. "peña") when I want to store this I get this error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 2: ordinal not in range(128)

I can change the Ñ by N, but, there not another and better way?

And if i encode the value, how can print "Peña" again?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不爱素颜 2024-09-14 02:22:35

GAE 以 unicode 存储字符串。也许在保存字符串之前将其编码为 un​​icode。

value = "peña"

value.encode("utf8")

GAE stores strings in unicode. Perhaps encode your string in unicode before saving it.

value = "peña"

value.encode("utf8")
情深已缘浅 2024-09-14 02:22:35

从错误(“Unicode解码错误”)来看,使用 Unicode 似乎会更幸运 - 我会尝试 UTF-8。

From the error ("Unicode Decode Error"), it seems you could have more luck using Unicode - I'd try UTF-8.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文