0

我正在使用 phpQuery 从 url 中提取数据。现在,当我从 url 中提取数据时,我会得到一些不正确或特殊的字符来代替文本。

Like:  ctype html> ,   ¢Â�Â�

我的脚本:-

PhpQueryComponent::newDocumentFileHTML($file,$charset='utf-8');

我的输出是: -

 ctype html> It's as if we created some text and blah just for you, the small business owner
or self-employed carpenter, gardener, caretaker, artist or shop owner who needs all the 
help you can get. On Sfsfsdfe, you can create your own website so your clients can   
find you. Display all your products in photo albums, describe your services or 
experience, and put up news and special events to create buzz around your business.      
¢Â�Â� the list is endless, and so are the tasks linked to running them. With fdsfsdf
albums � there's a function for your every need. Communicate directly on the page 
and keep each other up to date. 

我有 useutf-8 ,但它仍然无法正常工作。谁能告诉我为什么会显示这个错误。??提前致谢..

4

1 回答 1

1

您正在阅读的文件中可能有特殊字符,so this is happening as All HTML special characters might be broken up when parsed via phpQuery.

这是 phpQuery 的问题, 问题


更新:
你说“你用过 UTF-8”,你用过吗?..如果没有,请执行以下操作..

首先将您的文件保存为 UTF-8 格式并检查元部分,它应该是:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

还在开始时设置 php 标头header('Content-Type: text/html; charset=utf-8');

于 2013-01-31T08:39:03.763 回答