php - Extract special characters using DOMDocument -


how parse special characters html domdocument?

for eg, if want fetch paragraph this wikipedia page, i'm able with-

$dom= new domdocument(); $html = file_get_contents("http://en.wikipedia.org/wiki/aditya"); $dom->loadhtml($html); $items=$dom->getelementsbytagname('p'); foreach($items $item){     echo $item->textcontent;     break; } 

but in response get-

Ādityas instead of Ādityas,

à ¤†à ¤¦à ¤¿à ¤¤à ¥Âà ¤¯ instead of आदित्य , on..

basically want know how encode these characters when fetched domelement. later i'll saving them in database or plain text only.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -