[Bug #20025] Check if upper/lower before fallback to case-folding

This commit is contained in:
Nobuyoshi Nakada 2023-11-29 14:40:21 +09:00
parent bd2b6b702c
commit 79eb75a8dd
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
2 changed files with 7 additions and 2 deletions

View File

@ -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 (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 (ONIGENC_IS_UNICODE(enc)) {
static int ctype_titlecase = 0;
if (!ctype_titlecase) {
static const UChar cname[] = "titlecaseletter";
static const UChar *const end = cname + sizeof(cname) - 1;

View File

@ -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