A disgusting garbled question

Source: Internet
Author: User
A disgusting garbled problem program needs to insert a piece of data into another database program and the database itself is UTF-8 & nbsp; but the other database code is very messy, the result is that it cannot be inserted or garbled. CREATE & nbsp; TABLE & nbsp; IF & nbsp; NOT & nbs is a disgusting garbled problem.
The program needs to insert a piece of data into another database.
The program and database itself are UTF-8 but another database encoding is messy, the result is NOT inserted or garbled, create table if not exists 'mem _ m '(
'Memm _ loginname' varchar (20) character set latin1 default null comment '?????? ',

This is the field,
Show variables like 'character _ set _ % ';
Variable_name Value
Character_set_client utf8
Character_set_connection latin1
Character_set_database utf8
Character_set_filesystem binary
Character_set_results utf8
Character_set_server latin1
Character_set_system utf8

How to solve this problem
------ Solution --------------------
'Memm _ loginname' varchar (20) character set latin1 default null comment '?????? ',
Yes
'Memm _ loginname' varchar (20) character set latin1 default null comment 'login name ',
This table is actually created in the gbk environment.
Although it is character set latin1
However, the content in the table is still gbk

If you only want to read the content, you do not need to access it.
Set names command. if used, it should also be
Set names latin1
Convert the read content to UTF-8 using iconv ('gbk', 'utf-8', $ MemM_LoginName ).

If you want to convert the entire table, you can use mysqldump instead of phpmyadmin.
You can search for "gbk latin1"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.