Project

General

Profile

Actions

Bug #3599

closed

Incorrect Regexp inspect for ASCII-8BIT String

Added by phasis68 (Heesob Park) almost 14 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2010-07-22 trunk 28707) [i686-linux]
Backport:
[ruby-core:31431]

Description

=begin
irb(main):001:0> a = Regexp.new("\xF1\xF2\xF3".force_encoding('ASCII-8BIT'))
=> /\xF1/
irb(main):002:0> puts a.inspect
/\xF1/
=> nil
irb(main):003:0> "\xF0\xF1".force_encoding('ASCII-8BIT') =~ a
=> nil
irb(main):004:0> a.source
=> "\xF1\xF2\xF3"
irb(main):005:0> "\xF0\xF1\xF2\xF3".force_encoding('ASCII-8BIT') =~ a
=> 1
=end

Actions #1

Updated by phasis68 (Heesob Park) almost 14 years ago

=begin
Here is a simple patch for this bug.

--- re.c 2010-07-22 16:12:01.536788151 +0900
+++ re.c.new 2010-07-22 16:13:15.229038356 +0900
@@ -373,7 +373,8 @@
int l;
if (resenc) {
unsigned int c = rb_enc_mbc_to_codepoint(p, pend, enc);

  •               l = rb_str_buf_cat_escaped_char(str, c, unicode_p);
    
  •               rb_str_buf_cat_escaped_char(str, c, unicode_p);
    
  •               l = clen;
              }
              else {
                  l = mbclen(p, pend, enc);
    

=end

Actions #2

Updated by naruse (Yui NARUSE) almost 14 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r28715.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0