简体   繁体   中英

PHP reading external xml file - encoding issue

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
</head>
<body>
    <?php
    $url = 'http://www.koeri.boun.edu.tr/sismo/zeqmap/xmlt/son24saat.xml';
    $html = file_get_contents($url);

//Change encoding to UTF-8 from ISO-8859-1
    $a = iconv('ISO-8859-1', 'UTF-8//IGNORE', $html);

    print_r($a);

    ?>

</body>

ÿþ< ?xml version="1.0" encoding="ISO-8859-1" ?> < eqlist> ...

您的字符集不是utf-8,但是xml编码是。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM