【问题标题】:cannot get the exact charset using file_get_html无法使用 file_get_html 获取确切的字符集
【发布时间】:2012-10-04 18:12:47
【问题描述】:

我正在尝试使用简单 html dom 的 file_get_html 从网站获取详细信息。我尝试的链接是:http://dns.marnet.net.mk/registar.php?dom=test.mk

我得到的都是问号

������ ������������ ������: 
test.com.mk
test.mk
�������� �� �������: test.mk [ ����� ��:15507 ]
���� �� ���� � ������� ��������������: 24-02-2013
���� �� ������������ �� �������:

24-02-2009
����� ��� �� ������������:

��� ��������� �������-������ ����� ������, ������� �� �����������, ���������, �������� � ������
������ �� ������������:

���. ����� �������� ��. 15/10, ������
��� �� ������������:

4030006605991
�������� �� ������������:

02/3114-001

��������������� �������
���:

����� ���������
e-mail:

zivko@prologistics.com
�������:

02/3114-000
�������� �������
���:

����� ���������
e-mail:

boris@proinformatics.com
�������:

02/3114-002
������� �����������
���
IP
ns2.powweb.com  65.254.254.134
ns1.powweb.com  65.254.254.135

如何获取网站中使用的原始字符?

【问题讨论】:

    标签: php ajax simple-html-dom


    【解决方案1】:

    我找到了解决办法。

    我在 file_get_html 命令之后添加了这个。

    $html=mb_convert_encoding($html,'utf8','windows-1251');
    

    这根据需要转换了我的字符集。

    感谢所有回复的人。

    【讨论】:

      【解决方案2】:

      查看源代码时,我刚刚检查了页面上的字符集: 它给了我这个:

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

      【讨论】:

      • $html=mb_convert_encoding($html,'utf8','windows-1251');这成功了。
      猜你喜欢
      • 2014-07-19
      • 2021-10-29
      • 2012-12-03
      • 2011-03-28
      • 2020-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-21
      相关资源
      最近更新 更多