Troubleshooting of referrers garbled characters _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Solve the garbled problem of referrers. The referrers system can display reverse links. Currently, the latest referer statistics on many sites use Stephen's referrer statistics system. The referrers system we will discuss today can display reverse links very well. Currently, the latest referer statistics on many sites use Stephen's referrer statistics system. What we want to discuss today is not its installation, but its character set garbled characters.

This software has a character set problem, this problem I want you to encounter, because my blog is a UTF-8 character, and a lot of domestic reverse links are GB2312, therefore, garbled characters are displayed in GB2312. It is very ugly, so it is necessary to unify character sets through technical means.

With the help of hedong, the problem was finally solved. It is actually using icov and Text-Iconv-1.2 to change GB2312 to UTF-8. The procedure is as follows:

1. check whether the iconv software package is installed.

Iconv-V

If the iconv does not exist, install the glibc-common *. rpm package.

2. download the Text: Iconv module and install it.
Wget http://search.cpan.org/CPAN/authors/id/M/MP/MPIOTR/Text-Iconv-1.2.tar.gz
Tar zxvf Text-Iconv-1.2.tar.gz
Cd Text-Iconv-1.2
Perl Makefile. PL
Make
Make test
Make install

3. configure referrers. cgi (not many people are using it now ).
In use cgi (not many people are using it now) qw (: cgi (not many people are using it now)-lib); then add the following statement;
Use Text: Iconv;
My $ converter = Text: Iconv-> new ("GB2312", "UTF-8 ");

Add the following statement in the code # Print out the information:
If (index ($ durl, "baidu.com")>-1 | index ($ durl, "msnfans.com")>-1 | index ($ durl, "mybh.net")> -1 | index ($ durl, "hed
Ong.3322.org ")>-1 ){
$ Dtit = $ converter-> convert ($ dtit );
}

In the future, websites that need to convert character sets will be manually added.

If you are a UTF-8 passed GB2312 is similar

Thanks again for the help of hedong :)

Round (referer) statistics use Stephen's referrer statistics system. What we want to discuss today...

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.