453 h garbled characters installed in MySQL 4.1

Source: Internet
Author: User

This article mainly teaches you how to correctly solve the problem of garbled code and installation failure caused by 453 h installation in the UTF8 database above MySQL 4.1. I have tried to install mambo 4.53h these days, because my database is mysq4.1 or later and the Set character set is UTF8.

After several installation attempts, the following situations are found:

1. set the database to latin1 without modifying any files. During installation, the installation can be completed no matter whether gb2312 or utf8 is selected, and the webpage is displayed normally. However, it is found that when you read the data table through phpmyadmin, all Chinese characters in the table are garbled. That is to say, the Chinese webpage can be displayed normally after being saved using the latin1 character set, but Chinese characters are garbled in the database. In addition, files backed up by phpmyadmin cannot be backed up. No matter what encoding is changed, Chinese characters in the files are garbled ). So this is not king, and I did not make a choice.

2. Set the database character set to utf8 without modifying any files. During installation, the error 1071 specified key too long max length 1000 bytes occurs no matter whether gb2312 or utf8 is selected. In addition, as long as the database character set is set to utf8, utf8 is a character set as 3 bytes storage, and latin1 is as 1 bytes storage), No matter according to some comments in the Forum, modify installation/SQL/mambo. SQL or other files may encounter an error where the key exceeds bytes. The installation cannot continue.

I meant to install the Chinese utf8 version of manbo to facilitate integration with other programs. After searching google, forums, and other materials, I tried to use my ideas to select the utf8 Character Set of manbo to be above MySQL4.1, the character set is also installed successfully in the utf8 database. The webpage displays normal Chinese characters without garbled characters. When you use phpmyadmin to query database tables, all Chinese characters are displayed normally and saved in utf8. The following are my solutions for your reference only:

First, set the database character set to utf8,

CODE: [Copy to clipboard] alter database default character set utf8 COLLATE utf8_general_ci

You can also directly change it in phpmyadmin.

Modify the installation/SQL/mambo. SQL file:

Find all

CODE: [Copy to clipboard] TYPE = MyISAM;

Replace

CODE: [Copy to clipboard] TYPE = MyISAM default charset = utf8 COLLATE = utf8_general_ci;

Search

CODE: [Copy to clipboard] unique key 'section _ value_value_aro '('section _ value', 'value ')

And

CODE: [Copy to clipboard] UNIQUE key' #__ gacl_section_value_value_aro '('section _ value', 'value '),

And comment out or delete the two lines of code with #. whatever ~~

In this Code section

CODE: [Copy to clipboard] # Table structure for table '#__ core_acl_aro_groups'

The following four lines of code are added in sequence:

CODE: [Copy to clipboard] alter table '#__ core_acl_aro 'Chang' section _ value' VARCHAR (240) character set latin1 COLLATE latin1_bin not null default '0 ';

CODE: [Copy to clipboard] alter table '#__ core_acl_aro 'change 'value' value' VARCHAR (240) character set latin1 COLLATE latin1_bin not null default '';

CODE: [Copy to clipboard] alter table '#__ core_acl_aro 'add UNIQUE 'section _ value_value_aro' ('section _ value', 'value ');

CODE: [Copy to clipboard] alter table '#__ core_acl_aro 'add unique' #__ gacl_section_value_value_aro' ('section _ value', 'value ');

Modify the replicdes/database. php file:

Search

CODE: [Copy to clipboard] $ this-> _ table_prefix = $ table_prefix;

Add the following three lines of code under this line:

CODE: [Copy to clipboard] MySQL 4.1 query ("set names 'utf8'", $ this-> _ resource );

CODE: [Copy to clipboard] MySQL (the best combination with PHP) _ query ("set character set utf8", $ this-> _ resource );

CODE: [Copy to clipboard] MySQL (the best combination with PHP) _ query ("SET COLLATION_CONNECTION = 'utf8 _ general_ci '", $ this-> _ resource );

Save the modification.

During installation, select UTF8 as the encoding format.

After the modification, the system can be installed normally and the Chinese characters in the database can be displayed and saved normally. If you need to integrate discuz or other programs, you can also select the UTF8 version, after integration, Chinese user names are not used during registration, but garbled characters are displayed after registration.

Notes

After this method is modified, modify the mongodes/database. php when upgrading manbo. Otherwise, an error occurs.

The above modification method is based on several experts in the Forum, some English documents found through google search, and some documents from TW manbo, after the modification is attempted and tested, there is no problem. I hope it will be helpful for friends who encounter the same problem! A useful friend is worthy of the many things I have written.

Related Article

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.