Saturday, 28 May 2016

mysql - php - how to convert non utf-8 string to utf-8

I've a php page that return a string in persian , this is the content I have now :



    Ùروشگاه تعطیل Ù…ÛŒ باشد .

ساعت کاری Ùروشگاه 8 الی 22
روزهای شنبه تا پنج شنبه


as you can see, the encoding is wrong and it's not readable ,I need to convert it to utf-8 encoding .
I'm returning the data from database, encoding of table and cell in database is utf8_persian_ci and it's shows currency in phpmyadmin .



How can I convert this non readable string to utf-8 encoding and make it readable ?
I've tried utf8-encoding and below code but non of them works :




    echo iconv(mb_detect_encoding($string, mb_detect_order(), true), "UTF-8", $string);


How can I fix this ?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...