diff-match-patch
diff-match-patch copied to clipboard
Optimize Unicode chr/ord
Small optimization for unicodeChr() and unicodeOrd().
The maintainer of this project and the author of this PR have probably moved on a long time ago.
For anyone stopping by here, in modern versions of you PHP you can just do:
public static function unicodeChr($code) {
return mb_chr($code, 'UCS-2LE');
}
public static function unicodeOrd($char) {
return mb_ord($char, 'UCS-2LE');
}
Note that in my private patched copy of yetanotherape/diff-match-patch I'm using UTF-8 everywhere instead of UCS-2LE. Without having tested it, I would wager that the mb_* functions will also work when the encoding is UCS-2LE.