diff --git a/ChangeLog b/ChangeLog index 4ca02ddf87..d2330e440a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Feb 6 19:04:32 2003 Yukihiro Matsumoto + + * re.c (rb_reg_initialize_m): shoule not preset "kcode" unless + encoding is explicitly specified. + Thu Feb 6 19:01:32 2003 Minero Aoki * lib/fileutils.rb: new method FileUtils.pwd. diff --git a/re.c b/re.c index b837da8c3f..4b8c821d2b 100644 --- a/re.c +++ b/re.c @@ -1239,21 +1239,23 @@ rb_reg_initialize_m(argc, argv, self) } rb_reg_check(argv[0]); flags = RREGEXP(argv[0])->ptr->options & 0xf; - switch (RBASIC(argv[0])->flags & KCODE_MASK) { - case KCODE_NONE: - flags |= 16; - break; - case KCODE_EUC: - flags |= 32; - break; - case KCODE_SJIS: - flags |= 48; - break; - case KCODE_UTF8: - flags |= 64; - break; - default: - break; + if (FL_TEST(argv[0], KCODE_FIXED)) { + switch (RBASIC(argv[0])->flags & KCODE_MASK) { + case KCODE_NONE: + flags |= 16; + break; + case KCODE_EUC: + flags |= 32; + break; + case KCODE_SJIS: + flags |= 48; + break; + case KCODE_UTF8: + flags |= 64; + break; + default: + break; + } } s = RREGEXP(argv[0])->str; len = RREGEXP(argv[0])->len;