From 6cafb5bec243c977599f897f38efcf45e27af9a3 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 8 Oct 2015 14:37:39 +0100 Subject: [PATCH] Fixes #22. Diacritics allowed in record cleaner rule files. --- application/config/version.php | 2 +- modules/data_cleaner/controllers/verification_rule.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/application/config/version.php b/application/config/version.php index b87d917ee3..b29041f070 100644 --- a/application/config/version.php +++ b/application/config/version.php @@ -26,7 +26,7 @@ /** * @var string The application files version number. */ -$config['version'] = '0.9.1.6'; +$config['version'] = '0.9.1.7'; $config['release_date'] = '2015-10-08'; $config['repository'] = 'https://github.com/Indicia-Team/warehouse/releases'; diff --git a/modules/data_cleaner/controllers/verification_rule.php b/modules/data_cleaner/controllers/verification_rule.php index 78a8f8dcca..b17b5dcbd7 100644 --- a/modules/data_cleaner/controllers/verification_rule.php +++ b/modules/data_cleaner/controllers/verification_rule.php @@ -386,6 +386,9 @@ private function internal_upload_rule_file($totaldone, $cacheArr) { throw new exception("Could not open file $filepath"); } $filecontent = fread($resource,1000000); + // if no BOM, not unicode, so convert for safety. See Warehouse issue 22. + if (strpos($filecontent, "\xEF\xBB\xBF")!==0) + $filecontent = utf8_encode($filecontent); $settings = data_cleaner::parse_test_file($filecontent); $this->read_rule_content($settings, $cacheArr['files'][$totaldone]['path'], $cacheArr['files'][$totaldone]['source_url']); return $cacheArr['files'][$totaldone]['display'];