开发者

Codepage related problems with MySQL++

开发者 https://www.devze.com 2023-01-18 02:38 出处:网络
Code: mysqlpp::Query acc_query = connection->query(\"SELECT * FROM accounts;开发者_如何学Go\"); The following code produces:

Code:

mysqlpp::Query acc_query = connection->query("SELECT * FROM accounts;开发者_如何学Go");

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消