简体   繁体   中英

PHP Cant read file with special chars

I'm loading a file by this script:

$hFile = fopen($sFile, "r");
$sContent = "";

while(!feof($hFile)) {
    $sContent .= fread($hFile, 4096);
}

fclose($hFile);

It works as it should do, but i tried to load a file called test.txt which contains the following string: <>863b?)(/&(§&/))!)!=WLKM! K!*ÜQWW!W3³³w2_:LPE <>863b?)(/&(§&/))!)!=WLKM! K!*ÜQWW!W3³³w2_:LPE

The variable $sContent now doesn't contain anything.

$html = mb_convert_encoding($html, "UTF-8");

首先要执行此操作,然后再写入文件。

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