From 5e90c066e88de63d944bddddfc72511100a22d62 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Fri, 8 Nov 2013 04:40:18 -0800 Subject: [PATCH] https://github.com/PHPOffice/PHPWord/issues/34 PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input --- src/PHPWord/Shared/String.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PHPWord/Shared/String.php b/src/PHPWord/Shared/String.php index 64309229..3dcdc80e 100644 --- a/src/PHPWord/Shared/String.php +++ b/src/PHPWord/Shared/String.php @@ -141,13 +141,13 @@ class PHPWord_Shared_String } /** - * 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; } /**