Google Gears 的 SQLite 字符编码

发布于 2024-08-30 12:54:16 字数 379 浏览 1 评论 0原文

我们使用 jQuery 从服务器获取 JSON 字符串(UTF-8 响应,也是通过 jQuery 的 UTF-8 请求),并将此 JSON 放入 Google Gears WorkerPool 中。该工作池处理 JSON 并将其存储到 Gears 数据库 (SQLite) 中。

事实证明,SQLite 显然使用 iso-8859-1 而不是 UTF-8 存储数据。由于我们尝试存储可能包含西里尔字符(以及您在欧洲可能遇到的其他字符)的用户名,因此这会出现严重错误。

谁能告诉我如何更改 Gears WorkerPool 或 Gears 使用的 SQLite 数据库中的字符编码?当然,如果我的问题方向错误,请随时提供替代方案!

不幸的是,HTML5 不是一个选项,因为我们应该主要支持 IE7。

We're using jQuery to get a JSON-string from our server (UTF-8 response, also UTF-8 request through jQuery) and put this JSON into a Google Gears WorkerPool. This workerpool processes the JSON and stores it into a Gears database (SQLite).

It turns out that, apparently, SQLite stores data using iso-8859-1 rather than UTF-8. Since we're trying to store user names that might contain Cyrillic characters (and others that you might encounter in Europe), this goes horribly wrong.

Can anyone tell me how to change the character encoding in either the Gears WorkerPool or the SQLite database that Gears employs? Of course, if I'm looking in the wrong direction with my problem, feel free to offer alternatives!

Unfortunately, HTML5 isn't an option as we're supposed to support IE7 primarily.

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

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

发布评论

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

评论(1

薄暮涼年 2024-09-06 12:54:16

在定义任何表之前尝试“PRAGMA编码='utf-8'”。
请参阅此链接

此链接用于 SQLites PRAGMA 语法

Try "PRAGMA encoding='utf-8' " before you define any tables.
see This link

And this link for SQLites PRAGMA syntax

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