Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.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中的字符_Php_Html_Encoding_Utf 8_Character Encoding - Fatal编程技术网

修复PHP中的字符

修复PHP中的字符,php,html,encoding,utf-8,character-encoding,Php,Html,Encoding,Utf 8,Character Encoding,有人知道这是什么以及如何修复它吗?“天哪”� <p>After 32 years in its former location, this popular restaurant and bar moved to the bottom of the Avalon Bay Luxury residential building that's just a walk from Angel Stadium. Modern and welcoming, the expansiv

有人知道这是什么以及如何修复它吗?“天哪”�

<p>After 32 years in its former location, this popular restaurant 
   and bar moved to the bottom of the Avalon Bay Luxury residential building 
   that's just a walk from Angel Stadium. Modern and welcoming, the expansive 
   space is where fans, locals and families gather for upscale twists on classic
   American dishes. Burgers here have a decidedly fun flair like “The OMG� 
   that is a burger surely meant for sharing (with many)--it's so huge that it's 
   served on a 14-inch bun. The restaurant also specializes in seafood with such 
   items as Chilean sea bass, mahi mahi and swordfish. The lounge also serves 
   signature drinks like  the Rally Monkey Martini in tribute to the mascot 
   of the Angels.</p>

查看此页面

在本页中,您将发现UTF-8编码的简单明了的解释,以及如何在您的网站中应用UTF-8编码以及一些实际示例


您还需要确保使用UTF-8编码保存文件(无BOM)。

您的字符集是否设置为Latin1?尝试使用UTF-8,看看是否可以修复它

这些将是Unicode utf-8中的microsoft引号。

在PHP中,您可以设置页面字符集:

header("Content-type: text/html; charset=utf-8");
我发现这很有帮助:

然后像这样使用它:

$replace = array("&Scaron;");
$replace = array("&scaron;");
$search = array("Š"); 
$search = array("š");  

$queryText= mb_replace($search, $replace, $queryText);

echo urlencode(htmlentities('OMG'))�'));不确定这是否是您想要的。输出
%26Atilde%3B%26cent%3B%26acirc%3B%82%26not%3B%26Aring%3B%93The+OMG%26Atilde%3B%26cent%3B%26acirc%3B%82%26not%3B%26iuml%3B%26iquest%3B%26frac12%3B
您解决了问题了吗?$editorial\u review=mb\u convert\u编码($value[“editorial\u review”],'UTF-8','UTF-8'))“没有帮助。页面设置为utf-8,我的web浏览器也设置为utf-8。不确定数据设置为什么,它来自API。似乎这些字符已经是url编码的,没有注意到,因为firefox没有在视图选择源中显示它们。它们是:â;€;œ;OMGâ;€;;。现在我需要处理这些字符。也许可以尝试一下。”dechex()然后检查utf8编码?最完整的答案是imho。请注意,您还需要使用utf8(不带BOM)保存文件。因为在ISO文件中键入特殊字符并尝试将其显示为utf8也会中断;-)@Capsule:谢谢!没错,我会将此添加到我的答案中。page设置为utf-8,我的web浏览器也是。不确定数据设置为什么,它来自API。page设置为utf-8,我的web浏览器也是。不确定数据设置为什么,它来自API。这是一个愚蠢的函数-名称假装它是str_replace的替代品,但事实并非如此。
str\u replace
已经是二进制安全的,这意味着您可以处理任何多字节字符串而不会出现任何问题
$replace = array("&Scaron;");
$replace = array("&scaron;");
$search = array("Š"); 
$search = array("š");  

$queryText= mb_replace($search, $replace, $queryText);