From 44f8cde9aa0d483b009f012de7f54c4c7f64f0a3 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 10 Oct 2017 21:56:23 +0200 Subject: [PATCH] Invisible name check: detect all utf8 space characters --- qcsrc/lib/string.qh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/qcsrc/lib/string.qh b/qcsrc/lib/string.qh index b05a316c9..0a3fb085c 100644 --- a/qcsrc/lib/string.qh +++ b/qcsrc/lib/string.qh @@ -256,6 +256,7 @@ int u8_strsize(string s) return l; } +//List of Unicode spaces: https://www.cs.tut.fi/~jkorpela/chars/spaces.html ERASEABLE bool isInvisibleString(string s) { @@ -272,8 +273,26 @@ bool isInvisibleString(string s) case 192: // charmap space if (!utf8) break; return false; - case 160: // space in unicode fonts case 0xE000 + 192: // utf8 charmap space + case 0x00A0: // NO-BREAK SPACE + //case 0x1680: // OGHAM SPACE MARK + case 0x180E: // MONGOLIAN VOWEL SEPARATOR + case 0x2000: // EN QUAD + case 0x2001: // EM QUAD + case 0x2002: // EN SPACE + case 0x2003: // EM SPACE + case 0x2004: // THREE-PER-EM SPACE + case 0x2005: // FOUR-PER-EM SPACE + case 0x2006: // SIX-PER-EM SPACE + case 0x2007: // FIGURE SPACE + case 0x2008: // PUNCTUATION SPACE + case 0x2009: // THIN SPACE + case 0x200A: // HAIR SPACE + case 0x200B: // ZERO WIDTH SPACE + case 0x202F: // NARROW NO-BREAK SPACE + case 0x205F: // MEDIUM MATHEMATICAL SPACE + case 0x3000: // IDEOGRAPHIC SPACE + case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE if (utf8) break; default: return false; -- 2.39.2