diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2025-05-24 15:36:08 +0200 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2025-05-24 15:36:08 +0200 |
commit | fc524f75ee10bc4e8fc33e250f69949dbedc1935 (patch) | |
tree | 952d79967375e997585c811f40d50ed50e01ece9 /libunicode.c | |
parent | dfc254af513d6b7ca29616444728a43ffd7cb192 (diff) | |
download | quickjs-fc524f75ee10bc4e8fc33e250f69949dbedc1935.tar.gz quickjs-fc524f75ee10bc4e8fc33e250f69949dbedc1935.zip |
added missing 'Unknown' unicode Script
Diffstat (limited to 'libunicode.c')
-rw-r--r-- | libunicode.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libunicode.c b/libunicode.c index b4a0206..3791523 100644 --- a/libunicode.c +++ b/libunicode.c @@ -1285,8 +1285,6 @@ int unicode_script(CharRange *cr, script_idx = unicode_find_name(unicode_script_name_table, script_name); if (script_idx < 0) return -2; - /* Note: we remove the "Unknown" Script */ - script_idx += UNICODE_SCRIPT_Unknown + 1; is_common = (script_idx == UNICODE_SCRIPT_Common || script_idx == UNICODE_SCRIPT_Inherited); @@ -1316,17 +1314,21 @@ int unicode_script(CharRange *cr, n |= *p++; n += 96 + (1 << 12); } - if (type == 0) - v = 0; - else - v = *p++; c1 = c + n + 1; - if (v == script_idx) { - if (cr_add_interval(cr1, c, c1)) - goto fail; + if (type != 0) { + v = *p++; + if (v == script_idx || script_idx == UNICODE_SCRIPT_Unknown) { + if (cr_add_interval(cr1, c, c1)) + goto fail; + } } c = c1; } + if (script_idx == UNICODE_SCRIPT_Unknown) { + /* Unknown is all the characters outside scripts */ + if (cr_invert(cr1)) + goto fail; + } if (is_ext) { /* add the script extensions */ |