From edfe4a0ccddef72056ffb235007e82d11ca88b57 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 11 Apr 2018 09:26:56 +0200 Subject: [PATCH] fixed mixing symbols and letters in unicode detector on pre N --- .../siacs/conversations/utils/IrregularUnicodeDetector.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java b/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java index e323b67db..ad1a1f8a9 100644 --- a/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java +++ b/src/main/java/eu/siacs/conversations/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 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; }