Browse Source

Streamlined unicode checks

A bunch of listed characters are in a sequence, so we can just run two
ifs for that.
nosoop 7 years ago
parent
commit
35880d3e7d
1 changed files with 8 additions and 16 deletions
  1. 8 16
      scripting/csrd_name_filter.sp

+ 8 - 16
scripting/csrd_name_filter.sp

@@ -15,7 +15,7 @@
 
 #pragma newdecls required
 
-#define PLUGIN_VERSION "1.0.2"
+#define PLUGIN_VERSION "1.0.3"
 public Plugin myinfo = {
 	name = "[CSRD] Name Filter",
 	author = "nosoop",
@@ -29,21 +29,6 @@ public Plugin myinfo = {
 
 int g_FilteredMultiByteWhitespace[] = {
 	0xe2a080, // braille pattern blank U+2800
-	0xe2819f, // medium mathematical space U+205F
-	
-	/* invisible math operators, &c. (char & 0xe281a0) */
-	0xe281a0, // word joiner U+2060
-	0xe281a1, // function application U+2061
-	0xe281a2, // invisible times U+2062
-	0xe281a3, // invisible separator U+2063
-	0xe281a4, // invisible plus U+2064
-	
-	0xe281aa, // inhibit symmetric swapping U+206A
-	0xe281ab, // activate symmetric swapping U+206B
-	0xe281ac, // inhibit arabic form shaping U+206C
-	0xe281ad, // activate arabic form shaping U+206D
-	0xe281ae, // national digit shapes U+206E
-	0xe281af, // nominal digit shapes U+206F
 	0
 };
 
@@ -128,6 +113,13 @@ void OnNameUpdated(int client) {
 }
 
 bool IsUnicodeCharInvisible(int uchar) {
+	// handle invisible math operators, &c. (U+205F ... U+206F)
+	// could do (char & 0xe281a0) plus check for U+205F, I think?
+	if (uchar >= 0xe2819f && uchar <= 0xe281af) {
+		return true;
+	}
+	
+	// handle other blacklisted characters
 	int c;
 	do {
 		if (uchar == g_FilteredMultiByteWhitespace[c]) {