Sunday, 18 March 2018

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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...