user2800040
user2800040

Reputation: 143

PHP HTML decode string-utf8

I have tried string in database . I want to display it in webpage . I tried

 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  

Also

 utf8_decode($n1);

Also

html_entity_decode($n1, ENT_COMPAT, "UTF-8");

Nothing works I see the string as it is. I have successfully didplayed this text in android device using URLdecoder method

The sample string is

 %E0%A4%95%E0%A4%B0%E0%A4%A3%E0%A5%80+%E0%A4%AE%E0%A4%BE%E0%A4%81+%E0%A4%97%E0%A5%8D%E0%A4%B0%E0%A5%81%E0%A4%AA+%E0%A4%AA%E0%A5%8D%E0%A4%B0%E0%A4%BE%E0%A4%87%E0%A4%B5%E0%A5%87%E0%A4%9F+%E0%A4%B2%E0%A4%BF%E0%A4%AE%E0%A4%BF%E0%A4%9F%E0%A5%87%E0%A4%A1 

It is in Hindi I hope you can help me .Thank you

Upvotes: 0

Views: 475

Answers (2)

Bjorn
Bjorn

Reputation: 5362

The string you've provided is URL encoded. If you pass it to urldecode(), it'll render just fine:

urldecode("%E0E0[snip]%E0%A4%A1"); //  करणी माँ ग्रुप प्राइवेट लिमिटेड 

http://php.net/manual/en/function.urldecode.php

Upvotes: 1

Ernesto
Ernesto

Reputation: 301

maybe you need to change the charset in the database
http://php.net/manual/es/mysqli.set-charset.php.
you will need to change it in the code where you connect to the database in the link you can get various examples

Upvotes: 0

Related Questions