Skip to content

Commit b8a5a8e

Browse files
committed
Merge pull request #21 from mschwerin/master
Match unicode characters when comparing for alphanum
2 parents 4b08188 + 643a9e3 commit b8a5a8e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

HtmlDiff.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private function ConvertHtmlToListOfWords( $characterString ) {
103103
$current_word = $character;
104104
$mode = 'whitespace';
105105
} else {
106-
if( ctype_alnum( $character ) && ( strlen($current_word) == 0 || ctype_alnum( $current_word ) ) ) {
106+
if( $this->IsAlphaNum( $character ) && ( strlen($current_word) == 0 || $this->IsAlphaNum( $current_word ) ) ) {
107107
$current_word .= $character;
108108
} else {
109109
$words[] = $current_word;
@@ -165,6 +165,10 @@ private function IsWhiteSpace( $value ) {
165165
return !preg_match( '[^\s]', $value );
166166
}
167167

168+
private function IsAlphaNum( $value ) {
169+
return preg_match( '/[\p{L}\p{N}]+/u', $value );
170+
}
171+
168172
private function Explode( $value ) {
169173
// as suggested by @onassar
170174
return preg_split( '//u', $value );

0 commit comments

Comments
 (0)