Skip to content

Commit e345d86

Browse files
committed
Merge pull request #37 from RomanSyroeshko/PHPWord#34
PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input
2 parents 1e50dc0 + 5e90c06 commit e345d86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PHPWord/Shared/String.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ public static function ControlCharacterPHP2OOXML($value = '') {
141141
}
142142

143143
/**
144-
* Check if a string contains UTF8 data
144+
* Check if a string contains UTF-8 data
145145
*
146146
* @param string $value
147147
* @return boolean
148148
*/
149149
public static function IsUTF8($value = '') {
150-
return utf8_encode(utf8_decode($value)) === $value;
150+
return $value === '' || preg_match('/^./su', $value) === 1;
151151
}
152152

153153
/**

0 commit comments

Comments
 (0)