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 = 'ابب'; $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
Post a Comment