Use new translation::detect_encoding() for encoding detection

This commit is contained in:
Nathan Gray 2012-10-24 16:59:00 +00:00
parent 99e1cad866
commit 084a5a5b93

View File

@ -62,7 +62,7 @@
// Check file encoding matches import // Check file encoding matches import
$sample = file_get_contents($content['file']['tmp_name'],false, null, 0, 1024); $sample = file_get_contents($content['file']['tmp_name'],false, null, 0, 1024);
$required = $options['charset'] == 'user' || !$options['charset'] ? $GLOBALS['egw_info']['user']['preferences']['common']['csv_charset'] : $options['charset']; $required = $options['charset'] == 'user' || !$options['charset'] ? $GLOBALS['egw_info']['user']['preferences']['common']['csv_charset'] : $options['charset'];
$encoding = mb_detect_encoding($sample,$required,true); $encoding = translation::detect_encoding($sample);
if($encoding && strtoupper($required) != strtoupper($encoding)) if($encoding && strtoupper($required) != strtoupper($encoding))
{ {
$this->message = lang("Encoding mismatch. Expected %1 file, you uploaded %2.<br />\n", $this->message = lang("Encoding mismatch. Expected %1 file, you uploaded %2.<br />\n",