Home > database >  Tencent mysql database of cloud, character set into utf8, but on the tencent cloud server in c langu
Tencent mysql database of cloud, character set into utf8, but on the tencent cloud server in c langu

Time:10-12

Turn to for help!!!!! , I under the tencent cloud server (centos 7 system) write a CPP program, the program used mysql c language interface to connect to tencent cloud mysql database, when inserted into the Chinese language, mysql database successfully insert data to the cloud, but show the code in Chinese and English is normal, the code below:

After writing the result of the diagram below (using Navicat queries) : , results for? Ae? O??? The test x? Who? '; Visible part is stil in Chinese, English test is normal,
Check a lot of information, tencent cloud of mysql database also is utf-8 character set, it is no problem, the screenshot is as follows: ,
With Navicat mysql database of cloud operation, insert the Chinese content can be successful, and shows the normal for the Chinese, their development and the application of cloud mysql database operation to insert data can also succeed in Chinese, and normal show Chinese, is operating on the tencent cloud server not a cloud mysql data into Chinese, and judge the problem is tencent cloud server (centos 7 system) here, I through the locale check system code, as follows: .
Also try to vi/etc/locale. Conf to modify the system coding for: LANG="zh_CN. Utf-8", also still won't do, exactly where the problem is, check data for a day, always can't solve, also the great spirit of all stripes, please help, thank you!!!!!

CodePudding user response:

Lang are you write wrong, should is en_US utf-8, how is your environment variables in utf8

CodePudding user response:

MySql in Chinese character set is utf8mb4, change to the try again

CodePudding user response:

Lang, that is the system that is like, just rent tencent cloud server is lowercase utf8, in centos 7 system using Chinese is normal, I just try to en_US. Utf-8, the result is still the same

CodePudding user response:

Utf8mb4 is a superset of the utf8, support for Chinese characters just characters in length, is actually the same, just some utf8mb4 compatibility stronger, just check the tencent cloud MYSQL server, it is utf8mb4 reply values, as follows:
  • Related