From b21a5094418cf14042de6a393ff220bc8c1e271b Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Fri, 8 Nov 2013 05:03:55 -0800 Subject: [PATCH] https://github.com/PHPOffice/PHPExcel/issues/265 PHPExcel_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input --- Classes/PHPExcel/Shared/String.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/PHPExcel/Shared/String.php b/Classes/PHPExcel/Shared/String.php index 3ba1be262..9ed18ba6a 100644 --- a/Classes/PHPExcel/Shared/String.php +++ b/Classes/PHPExcel/Shared/String.php @@ -397,13 +397,13 @@ public static function SanitizeUTF8($value) } /** - * Check if a string contains UTF8 data + * Check if a string contains UTF-8 data * * @param string $value * @return boolean */ public static function IsUTF8($value = '') { - return utf8_encode(utf8_decode($value)) === $value; + return $value === '' || preg_match('/^./su', $value) === 1; } /**