dongluojiao6322 2017-08-19 00:39
浏览 30

在php中没有UTF-8编码的匈牙利字母[重复]

This question already has an answer here:

I have a problem with my Display datas from Mysql php page. My problem is when I want to display some hungarian specific chars like "á" or "é" they replaced with question marks. I set all of my tables and rows to utf8_hungarian_ci, and the entire table and rows to utf8_unicode_ci, but it doesn't work. A tried in my php code to set this "header(Content-Type: text/html; charset=utf-8)" at the beginning of my php code, but i haven't got any success with that. Can anybody help me? Thank you! Edit: The code that I trying to use:

<?php
header('Content-Type: text/html; charset=utf-8');
function testfun()
{


$con=mysqli_connect('blabla");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM adatok");

echo "<table border='1'>";

$i = 0;
while($row = $result->fetch_assoc())
{
    if ($i == 0) {
      $i++;
      echo "<tr>";
      foreach ($row as $key => $value) {
        echo "<th>" . $key . "</th>";
      }
      echo "</tr>";
    }
    echo "<tr>";
    foreach ($row as $value) {
      echo "<td>" . $value . "</td>";
    }
    echo "</tr>";
}
echo "</table>";

mysqli_close($con);


}
   testfun();

?>
</div>
  • 写回答

1条回答 默认 最新

  • 普通网友 2017-08-19 00:52
    关注

    inside php tags use it this way $stringTest = htmlentities("ésé"); Then inside html tags use the variable

    or simply use header('Content-Type: text/html; charset=ISO-8859-1');

    评论

报告相同问题?

悬赏问题

  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)