Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php mb_detect_encoding()未按预期工作?_Php_Character Encoding - Fatal编程技术网

Php mb_detect_encoding()未按预期工作?

Php mb_detect_encoding()未按预期工作?,php,character-encoding,Php,Character Encoding,如果我没有把头发剪得这么短,我早就把它拔出来了,因为这个问题哈哈!非常感谢您的帮助,真的,我会为此发疯的 因此,我有一个字符串数据来自mysql数据库中的latin1表(不是我的选择),如下所示: Hi! I'm a string of text One possible explanation: The string replace would fail if the database does not contain the unicode character itself, but j

如果我没有把头发剪得这么短,我早就把它拔出来了,因为这个问题哈哈!非常感谢您的帮助,真的,我会为此发疯的

因此,我有一个字符串数据来自mysql数据库中的latin1表(不是我的选择),如下所示:

 Hi! I'm a string of text One possible explanation:

The string replace would fail if the database does not contain the unicode character itself, but just the html entity (
😜
or
😜
). It would also explain how a unicode character is surfacing in the latin1 character set, and also the detected
ascii
encoding. something like

echo str_replace( array('😜','😜'), '', $text );

你好!我是一串文本一种可能的解释:

如果数据库本身不包含unicode字符,而只包含html实体(
😜;
😜;
),则字符串替换将失败。它还将解释unicode字符如何出现在拉丁1字符集中,以及检测到的
ascii
编码。差不多

在那种情况下会有用的