Home  >  Article  >  Backend Development  >  PHP mb_convert_encoding problem record

PHP mb_convert_encoding problem record

WBOY
WBOYOriginal
2016-08-08 09:22:551209browse

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>

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.

Statement:
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