Project

General

Profile

Bug #4380

Encoding of result string for String#gsub! is not consistent for BINARY

Added by drbrain (Eric Hodel) almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3dev (2011-02-07 trunk 30814) [x86_64-darwin10.6.0]
Backport:
[ruby-core:35141]

Description

=begin
When String#gsub! is called on a string in BINARY encoding the encoding may be changed to the replacement encoding.

Attached is a test patch.
=end


Files

test_string.rb.gsub_bang_encoding.patch (591 Bytes) test_string.rb.gsub_bang_encoding.patch Test patch to illustrate the bug. drbrain (Eric Hodel), 02/08/2011 04:50 AM

Related issues

Has duplicate Ruby master - Bug #4382: Encoding of result string for String#gsub! is not consistent for BINARYClosed02/08/2011Actions

History

#1

Updated by drbrain (Eric Hodel) almost 9 years ago

  • File test_string.rb.gsub_bang_encoding.patch added

=begin

=end

#2

Updated by drbrain (Eric Hodel) almost 9 years ago

  • File deleted (test_string.rb.gsub_bang_encoding.patch)

=begin

=end

#3

Updated by naruse (Yui NARUSE) almost 9 years ago

  • Status changed from Open to Assigned
  • Assignee set to naruse (Yui NARUSE)

=begin

=end

#4

Updated by naruse (Yui NARUSE) over 8 years ago

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

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


  • string.c (rb_enc_cr_str_buf_cat): remove special treatment of
    ASCII-8BIT receivers.

  • string.c (str_gsub): set initial encoding of the buffer as the
    same of the receiver. [ruby-core:35141]
    =end

Also available in: Atom PDF