0

URLからデータを抽出するためにphpQueryを使用しています。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 に答える