MySQL 的代码页相关问题++

发布于 2024-09-24 18:47:49 字数 282 浏览 0 评论 0原文

代码:

mysqlpp::Query acc_query = 连接->query("SELECT * FROM 帐户;");

以下代码产生:

_Gfirst = 0x00c67718 "从帐户中选择 *;ээээ«««««««юоюою"

与 Visual Studio 调试器中一样。它似乎导致我的查询失败并出现奇怪的结果。

还有其他人遇到过吗?

Code:

mysqlpp::Query acc_query = connection->query("SELECT * FROM accounts;");

The following code produces:

_Gfirst = 0x00c67718 "SELECT * FROM accounts;ээээ««««««««юоюою"

As in Visual Studio debugger. It appears to cause my query to fail with weird results.

Has anyone else encountered it?

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

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

发布评论

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

评论(1

冷夜 2024-10-01 18:47:49

MySQL 最好使用 UTF-8 编码。代码页是一个以 Windows 为中心的预 Unicode 概念。您使用它们而不是 Unicode 可能可以解释为什么您会遇到问题。虽然可以让 MySQL — 以及 MySQL++ — 使用 Windows 风格的代码页,但在 2010 年您不应该这样做。

如果您使用 Unicode,它可能是 UTF-16 编码(Windows ' NT 衍生品中的本机编码),这又解释了很多。

在将所有字符串数据发送到 MySQL 之前将其转换为 UTF-8 形式,并将 MySQL 配置为在其表中使用 UTF-8 编码。

It's best to use UTF-8 encoding with MySQL. Code pages are a Windows-centric pre-Unicode concept. Your use of them instead of Unicode probably explains why you're having problems. While it's possible to make MySQL — and thus MySQL++ — work with Windows-style code pages, you shouldn't be doing that in 2010.

If you are using Unicode, it's probably UTF-16 encoding (Windows' native encoding in the NT derivatives), which again explains a lot.

Convert all string data into UTF-8 form before sending it to MySQL, and configure MySQL to use UTF-8 encoding in its tables.

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