[Bug #20025] Check if upper/lower before fallback to case-folding
This commit is contained in:
parent
bd2b6b702c
commit
79eb75a8dd
4
symbol.c
4
symbol.c
@ -225,10 +225,10 @@ rb_sym_constant_char_p(const char *name, long nlen, rb_encoding *enc)
|
||||
if (!MBCLEN_CHARFOUND_P(c)) return FALSE;
|
||||
len = MBCLEN_CHARFOUND_LEN(c);
|
||||
c = rb_enc_mbc_to_codepoint(name, end, enc);
|
||||
if (rb_enc_isupper(c, enc)) return TRUE;
|
||||
if (rb_enc_islower(c, enc)) return FALSE;
|
||||
if (ONIGENC_IS_UNICODE(enc)) {
|
||||
static int ctype_titlecase = 0;
|
||||
if (rb_enc_isupper(c, enc)) return TRUE;
|
||||
if (rb_enc_islower(c, enc)) return FALSE;
|
||||
if (!ctype_titlecase) {
|
||||
static const UChar cname[] = "titlecaseletter";
|
||||
static const UChar *const end = cname + sizeof(cname) - 1;
|
||||
|
@ -134,5 +134,10 @@ module Test_Symbol
|
||||
Bug::Symbol.find(cx)
|
||||
}
|
||||
end
|
||||
|
||||
def test_const_name_type
|
||||
sym = "\xb5".force_encoding(Encoding::Windows_1253)
|
||||
assert_not_operator Bug::Symbol, :const?, sym, sym.encode(Encoding::UTF_8)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user