I have a PHP script:
<?php
header('Content-Type: text/plain; charset=utf-8');//i have already used the
//header for encoding to utf-8
//rest of the code.
?>
I have already used the header for encoding to UTF-8, but when the values are fetched from the MySQL database and echoed, they are not displaying the proper output as in my MySQL database.
Detailed Explanation:
I have one print screen where the data is displaying correctly.
But when I export the same data in PDF, the encoding issue is occurring.
So I don't think this is a database issue.
Also the PHP code responsible for exporting the document to PDF contains the above mentioned header to set UTF-8.
Example:
"Meeùs" is displayed as "Mees".
Note:
My database is already set to UTF-8.
What I am doing wrong?
Because your database is not UTF8.
Try to set your db encoding to
UTF-8
, or useutf8_encode($data)
into your code after extract from database.Check if your IDE encodes your file to utf-8 without BOM.