From f109bb918f42823df00b052b72bfa8881d24f91f Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 12 Feb 2017 11:11:52 +0000 Subject: [PATCH] isspace: don't include characters. --- src/ctype.c | 10 +++++++++- tools/printdata.py | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ctype.c b/src/ctype.c index 9f9b91b9..d9818f90 100644 --- a/src/ctype.c +++ b/src/ctype.c @@ -140,10 +140,18 @@ int ucd_isspace(codepoint_t c) { case UCD_CATEGORY_Zl: case UCD_CATEGORY_Zp: + return 1; case UCD_CATEGORY_Zs: + switch (c) // Exclude characters with the DispositionType + { + case 0x00A0: // U+00A0 : NO-BREAK SPACE + case 0x2007: // U+2007 : FIGURE SPACE + case 0x202F: // U+202F : NARROW NO-BREAK SPACE + return 0; + } return 1; case UCD_CATEGORY_Cc: - switch (c) // Some control characters are also whitespace characters: + switch (c) // Include control characters marked as White_Space { case 0x09: // U+0009 : CHARACTER TABULATION case 0x0A: // U+000A : LINE FEED diff --git a/tools/printdata.py b/tools/printdata.py index 46a2fc1f..7c173add 100755 --- a/tools/printdata.py +++ b/tools/printdata.py @@ -50,7 +50,11 @@ def isxdigit(data): return 1 if data['CodePoint'].char() in '0123456789ABCDEFabcdef' else 0 def isspace(data): - return data.get('White_Space', 0) + if data.get('White_Space', 0): + dt = data.get('DecompositionType', '') + return 1 if dt == None or not dt.startswith('') else 0 + else: + return 0 def isupper(data): if data.get('LowerCase', null) != null: