Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of reading Chinese garbled codes with mysql CAPI interface

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "mysql CAPI interface reading Chinese garbled code problem how to solve", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in depth, together to study and learn "mysql CAPI interface read Chinese garbled problem how to solve" it!

In the recent yymysqlsdk open source project, the support for Chinese is not in place, so it took 1.5 days to analyze the situation of Chinese processing.

1. First confirm your mysql configuration file, my.ini (for configuration only). If not, add it.

[client]

Default-character-set=gbk (for the support of Chinese when developing client programs; if it is set to utf8 here, I have not verified it, and verify it later, )

[mysql]

Default-character-set=utf8

[mysqld]

Default-character-set=utf8

two。 Encoding attribute, select utf8, I am using naticat.

3. For tables, right-click to query the table information-"ddl, do you see a" ENGINE=InnoDB DEFAULT CHARSET=latin1; "?

By the way, this is the default encoding method used by naticat when designing the table. Please do not change this encoding method with the video. Latin1 is compatible with utf8 support (wild guess).

4. Then it is time to use vc to develop the client program. After real_connect, please execute the encoding setting, mysql_query (xxx, "set names latin1")

5. Look at the code.

View plain

Int rows = mysql_num_rows (res)

Int fields = mysql_num_fields (res)

For (int iTuno Bandi)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report