0

我通过从 html 文档加载数据

  header('Content-Type: …;charset=utf-8');  
  $html = file($link);

当我回显数据时,我得到了这个输出

Kindertagesstätte

但是 ä 应该是 Ä ...

有什么问题?

4

2 回答 2

0

您的 html 页面可能使用 ANSI 或 ISO-8859 编码

在您的 php 页面上:

header('Content-Type: text/html; charset=utf-8');

在您尝试链接的 HTML 页面上,您还应该检查编码。

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
于 2013-07-08T20:27:02.103 回答
0

尝试 php iconv ( http://www.php.net/manual/en/function.iconv.php )

例子:

<?php

echo iconv("your character set", "UTF-8", $html);

?>
于 2013-07-08T20:41:02.780 回答