如何检查文件的格式是UTF-8?

时间:2012-11-05 09:42:06

标签: php

我从客户端到服务器导入1个文件csv。 现在我想要检查这个文件的编码是utf-8。 如何在php中检查文件的格式是UTF-8?

2 个答案:

答案 0 :(得分:1)

使用此:

string mb_detect_encoding ( string $str [, mixed $encoding_list = mb_detect_order() [, bool $strict = false ]] )

请参阅Documentation

答案 1 :(得分:1)

在此查看检测PHP http://www.php.net/manual/en/function.mb-detect-encoding.php

中的文件编码