1

In my database, I have some content like this

അവരുടെ മനസ്സുകളില്‍.

But, when i am trying to fetch the content using PHP and display it in broswer, it is showing only some question marks like ????????? ???????. ??????.

I tried to set the content type header like this

header('Content-Type: text/html; charset=utf-8');

But it doesnt work.

How can i solve this ? any help would be greatly appreciated.

2 Answers 2

2

It does not work because you got this broken during data fetch and you are setting display encoding - it's already too late. Simply ensure correct encoding during connection by using either using proper method like mysqli_set_charset() or do query SET NAMES UTF8 just after your connect to DB

Sign up to request clarification or add additional context in comments.

Comments

1

Depending on the method you are using to connect to the DB, you should be specifying the charset.

With PDO, you can specify the charset in PDO::__construct(), such as: charset=UTF-8

Otherwise you have mysqli::set_charset() for MySQLi, or god forbid you're still using mysql_* functions there's mysql_set_charset()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.