PHP替换...用

Liz*_*ard 2 php string encoding multibyte

我有一个txt文件(根据Notepad ++用ANSI编码的文件),里面有'...'.我在逐行读取文件,我想替换...

我尝试的一切似乎都失败了

  1. $str = htmlentities($str); # trying to convert to … as I can deal with this
  2. $str = mb_ereg_replace("…","...",$str);
  3. $str = str_replace("…", "...", $str);

所有上述都不起作用!我错过了什么,我该如何解决这个问题?

注意:我试图解决此问题的PHP脚本以UTF8编码,php标头为UTF8

在此先感谢您的帮助!

ick*_*fay 6

如您所说,它用0x85文件中的字节表示,请尝试以下方法:

$str = str_replace("\x85", "...", $str);
Run Code Online (Sandbox Code Playgroud)