0

When I parse html using phpQuery, I got bad results with accentuated chars. The following code echo craps...

<?php 
    require_once 'phpQuery.php';
    $dom = phpQuery::newDocumentHTML('<p>é</p>');
    echo $dom->text(); //bad result
?>

Anybody know about accentuation in phpQuery?

I'm using netbeans on windows 2008 server with firefox.

3 Answers3

0

Try that:

echo htmlspecialchars($dom->text());
Jocelyn
  • 11,209
  • 10
  • 43
  • 60
0

Try to add on your page :

header("Content-Type:text/html; charset=UTF-8");

You welcome !

And by the way, I believe you use Windows 2008 Server and not Windows 7 Server ...

Charestm
  • 68
  • 1
  • 6
  • Well I don't know if you have JS in your page but if that the case, you can still try this function : [http://www.navioo.com/javascript/tutorials/Javascript_utf8_encode_1529.html] – Charestm Jun 06 '12 at 20:24
0

Have you tried

string utf8_decode ( string $data )

or

string utf8_encode ( string $data )

I believe as my previous answer that it must be a UTF-8 problem.

Charestm
  • 68
  • 1
  • 6