php - How to convert HTML code of Unicode to Real Unicode Character -


is there php function can convert

ابب 

to equallent unicode character

ت ب ا 

i have googled lot, think there no php built in function available purpose. actually, want store user submitted comments (that in unicode characters) mysql database. stored in format ابب in mysql database. using set names 'utf8' in mysql query. output in real unicode characters fine, insertion in mysql in format ابب don't want. solution??

i googled , found interesing solution here

i have tried , think working

<?php     $trans_tbl = get_html_translation_table(html_entities);     foreach($trans_tbl $k => $v)     {         $ttr[$v] = utf8_encode($k);     }     $text = '&#1575;&#1576;&#1576';     $text = strtr($text, $ttr);     echo $text; ?> 

for mysql solution can set character set

$mysqli = new mysqli($host, $user, $pass, $db);  if (!$mysqli->set_charset("utf8")) { die("error"); } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -