mysql - PHP DOMDocument won't parse XML string as UTF-8 -


i'm trying parse xml-formatted string domdocument. following code:

mysql_connect("localhost", "myusername", "mypassword") or die(mysql_error()); mysql_select_db("cmj_db") or die(mysql_error());  $data = mysql_query("select article_id, html_data articles article_id=".$_get["article_id"]) or die(mysql_error()); $dataarray = mysql_fetch_array($data); echo 'article: ' . $dataarray['article_id'] . '<br />';  $doc = new domdocument; $doc->loadxml(encoding::toutf8($dataarray['html_data'])); 

i error: warning: domdocument::loadxml(): input not proper utf-8, indicate encoding ! bytes: 0x96 0x20 0x6e 0x6f

there special characters involved, require utf encoding. when echo string on own, characters fine. might helpful note has been long succession of conversions.. unescaped lot of characters html encoding, , imported mysql table (with utf-9 charset). how can convert string unicode can parse xml?

thanks

have tried mb_convert_encoding()? mb_convert_encoding()

if understood correctly, encoding of xml utf-9, , need utf-8?

mb_convert_encoding($dataarray['html_data'], 'utf-8', 'utf-9') 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -