PHP mb_convert_encoding problem record

WBOY
Release: 2016-08-08 09:22:55
Original
1181 people have browsed it

I recently discovered a problem. When using the mb_convert_encoding function to transcode, some special symbols (???) were removed and replaced with question marks.

Then try to replace first and then transcode.

The code is as follows

<code><span>$arr</span> = <span>array</span>(
            chr(<span>0x99</span>) => <span>'&trade;'</span>, <span>//转gbk小心</span>
            chr(<span>0xA9</span>) => <span>'&copy;'</span>,
            chr(<span>0xAE</span>) => <span>'&reg;'</span>,
        );
mb_convert_encoding(strtr(<span>$str</span>,<span>$arr</span>),<span>'gbk'</span>,<span>'utf-8'</span>);
</code>
Copy after login

But there is still a problem, the main problem still lies in this product.

PS:

  • mb_convert_encoding will appear?
  • iconv added //ignore will not
  • mb_detect_encoding function obtain the string (?) encoding is 'ISO-8859-2'

temporarily recorded

The above introduces the PHP mb_convert_encoding problem record, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!