diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-24 21:40:14 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-24 21:40:14 +0200 |
commit | db8c022cd055dd1d5ca554f3de260bbb9fce2107 (patch) | |
tree | 7c2d52dc1f76df7f63c5df544195353360421491 /src | |
parent | 3f9d360b15f57f09abc826289ec15195e9a22f17 (diff) |
fixed mixing symbols and letters in unicode detector on pre N
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/IrregularUnicodeDetector.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/IrregularUnicodeDetector.java b/src/main/java/de/pixart/messenger/utils/IrregularUnicodeDetector.java index 70e41231d..b54f8d074 100644 --- a/src/main/java/de/pixart/messenger/utils/IrregularUnicodeDetector.java +++ b/src/main/java/de/pixart/messenger/utils/IrregularUnicodeDetector.java @@ -117,6 +117,10 @@ public class IrregularUnicodeDetector { final int length = word.length(); for (int offset = 0; offset < length; ) { final int codePoint = word.codePointAt(offset); + offset += Character.charCount(codePoint); + if (!Character.isLetter(codePoint)) { + continue; + } Character.UnicodeBlock block = normalize(Character.UnicodeBlock.of(codePoint)); List<String> codePoints; if (map.containsKey(block)) { @@ -126,7 +130,6 @@ public class IrregularUnicodeDetector { map.put(block, codePoints); } codePoints.add(String.copyValueOf(Character.toChars(codePoint))); - offset += Character.charCount(codePoint); } return map; } |