Improved keyword sanitizer

This commit is contained in:
M66B 2020-05-03 23:30:01 +02:00
parent 0f14ee0fd2
commit 6646fb4567
1 changed files with 4 additions and 1 deletions

View File

@ -54,6 +54,7 @@ import java.net.IDN;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.text.Normalizer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -2063,7 +2064,9 @@ public class MessageHelper {
continue; continue;
sb.append(kar); sb.append(kar);
} }
return sb.toString();
return Normalizer.normalize(sb.toString(), Normalizer.Form.NFKD)
.replaceAll("[^\\p{ASCII}]", "");
} }
static String sanitizeEmail(String email) { static String sanitizeEmail(String email) {