php preg_match和iso-8859-1中的西里尔字母

php preg_match和iso-8859-1中的西里尔字母,php,regex,Php,Regex,我面临一个关于正则表达式和西里尔符号的问题。我只是尝试读取文件,使用preg_match并在哑函数中显示其内容,如下所示: ... $regex = '/"(.*)"/im'; $content = file_get_contents($file->getRealPath()); $filename = $file->getClientOriginalName(); preg_match_all($regex, $content, $matches); return var_du

我面临一个关于正则表达式和西里尔符号的问题。我只是尝试读取文件,使用preg_match并在哑函数中显示其内容,如下所示:

...
$regex = '/"(.*)"/im';
$content = file_get_contents($file->getRealPath());
$filename = $file->getClientOriginalName();

preg_match_all($regex, $content, $matches);

return var_dump($matches[0]);
样本输出:35=B 0420=8O卡巴斯基安全中心10 文件中的字符串:卡巴斯基安全中心10

我尝试了所有可能的转换,从不同的编码,使用一个函数,如

private function file_get_contents_utf8($fn) {
         $content = file_get_contents($fn);
          return mb_convert_encoding($content, 'UTF-8',
              mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
    } 
使用iconv、mb_转换_编码和其他方法,
并在打开文件时将文本转换为UTF-8,似乎没有任何效果。有什么建议可能是问题吗?

问题已经解决,基本上,在使用函数检查后,文件本身的编码是iso8859-2,但实际编码是UTS-2。

ISO 8859-1没有西里尔字母,ISO 8859-5有。ISO-8859-1也称为拉丁字母1。试试看。它用于多字节字符