土耳其语字符无法正确显示 [英] Turkish characters are not displayed correctly

查看:295
本文介绍了土耳其语字符无法正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MySql数据库使用utf-8编码,数据存储正确。我使用set_name utf8查询来确保调用的数据是utf-8 encoded.all数据库变量工作正常,只要头文件集是utf-8,但是静态html字符不能正常工作。当我设置标题字符集到ISO-8859-9变量显示不同,而html字符工作ok.can有人可以帮助我吗?
Utf8编码: http://oi48.tinypic.com/289kje1.jpg html标签有问题显示值。但来自数据库的php数据(绿色例如ağişler)是ok.ISO编码 http ://oi50.tinypic.com/287n2ph.jpg 这次html是好的,但php数据显示错误。

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.

<?php
    header('Content-Type: text/html; charset=ISO-8859-9');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>noname</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

推荐答案

您可以尝试在文件顶部明确添加内容类型,如下所示

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

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

并从您的代码中删除以下内容。

and remove the below from your code..

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

更新:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php echo "for example Ş and İ "; ?>   
</body>
</html>

上面的代码给出了以下输出:

The above code gives me the below output:

这篇关于土耳其语字符无法正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆