From 6708d5e5ff3be729c24fbf5ff515a955e4f8db79 Mon Sep 17 00:00:00 2001 From: jgarcia Date: Fri, 10 Nov 2006 21:01:19 +0000 Subject: [PATCH] Unicode character names can only be base strings -- notice this bug. --- src/c/character.d | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/c/character.d b/src/c/character.d index 9f2d04291..cb5f3aa54 100644 --- a/src/c/character.d +++ b/src/c/character.d @@ -446,16 +446,19 @@ cl_object cl_name_char(cl_object name) { cl_object c = gethash_safe((name = cl_string(name)), cl_core.char_names, Cnil); - if (c == Cnil && (name->base_string.self[0] == 'u' || name->base_string.self[0] == 'U')) { - /* more error checking? FIXME */ - cl_index end = name->base_string.fillp - 1; - cl_index real_end = end; - c = parse_integer(name->base_string.self + 1, end, - &real_end, 16); - if ((real_end != end) || !FIXNUMP(c)) { - c = Cnil; - } else { - c = CODE_CHAR(fix(c)); + if (c == Cnil && type_of(name) == t_base_string) { + c = cl_char(name, MAKE_FIXNUM(0)); + if (c == CODE_CHAR('u') || c = CODE_CHAR('U')) { + /* FIXME! This only works with base-strings */ + cl_index end = name->base_string.fillp - 1; + cl_index real_end = end; + c = parse_integer(name->base_string.self + 1, end, + &real_end, 16); + if ((real_end != end) || !FIXNUMP(c)) { + c = Cnil; + } else { + c = CODE_CHAR(fix(c)); + } } } @(return c);