Wednesday 27 July 2016

php - Turkish characters are not displayed correctly




MySql database uses utf-8 encoding and data are stored correctly.I use set_name utf8 query to make sure the data called are utf-8 encoded.all variables from database works fine as long as the header charset is utf-8,but the static html characters do not work properly.When i set header charset to ISO-8859-9 variables are displayed differenly while html characters work ok.can anyone help me?
Utf8 encoding: http://oi48.tinypic.com/289kje1.jpg html tags have problem displaying values.but php data(green ones e.g. ağişler) that come from database is ok.ISO encoding http://oi50.tinypic.com/287n2ph.jpg this time the html is ok but php data are displayed wrong.




    header('Content-Type: text/html; charset=ISO-8859-9');
?>


noname





Answer



You can try explicitly adding content type at the top of your file as below






and remove the below from your code..



header('Content-Type: text/html; charset=ISO-8859-9');



Update:







Untitled Document








The above code gives me the below output:



enter image description here


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...