Solution to the garbled problem-php Tutorial

Source: Internet
Author: User
The PHPcode *** is used to solve the garbled problem and shows how to find the original text .. * The question is that unicode should always be displayed regardless of the character. whether it can be converted to unicode encoding to achieve the effect. * $ strmanufacturering12 seconds? 16 bytes? 20 bytes? 24 hours? 36 bytes? 48 hours? 60, 72 & quot;, 84 & quot;, 96 & quot;, 120 & solve the garbled problem

PHP code
  /*** Shows how to find the original text with garbled characters .. * The question is that unicode should always be displayed regardless of the character. whether it can be converted to unicode encoding to achieve the effect. */$ str = 'manufacturering 12 success? 16 bytes? 20 bytes? 24 hours? 36 bytes? 48 hours? 60, 72 ", 84", 96 ", 120" sphere, Various styles '; // solving ....


------ Solution --------------------
Paste it here, all changed
You need to provide the original data and use base64_encode to encode it if necessary.
------ Solution --------------------
The mb_convert_encoding function can specify only the target character set for conversion without specifying the original character set. it will automatically detect the conversion (but not necessarily reliable)
------ Solution --------------------
Use UTF-8 for all. Even file encoding.
------ Solution --------------------
.. I don't know how to answer this question...
After all, the general conversion knows the original character set. if you really don't know .... Can I only try one by one?
------ Solution --------------------
The character set of the actual text represented by this binary data is currently unknown ..

Everything is possible. if BIG5 is incorrect.

Although unicode, utf8, and other character sets are compatible with texts in any language, you still need to know what the original character set is to convert the data to utf8 and other character sets.
------ Solution --------------------
Discussion

Reference:

Paste it here, all changed
You need to provide the original data and use base64_encode to encode it if necessary.


No matter how it changes, the binary data of these characters should not be changed. that is to say, they should correspond to a character encoding to be correctly displayed. but I don't know how to change the encoding.

------ Solution --------------------
However, you can guess the approximate


// Configure
/*
For ($ I = 0x80; $ I <0xfe; $ I ++)
For ($ j = 0x60; $ j <0xfe; $ j ++)
Echo iconv ('gbk', 'utf-8', chr ($ I). chr ($ j). ", $ I $ j ";
*/
Foreach (array (170,172,173,174,175,176,177,228,228,235,249) as $ n)
Echo chr (1, 161). chr ($ n );
/*
-‖... ''" "''' ※
*/

According to the context, "is the most likely

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.