Project

General

Profile

Bug #7967

String#encode invalid: :replace doesn't replace invalid chars

Added by coffeejunk (Maximilian Haack) over 6 years ago. Updated over 6 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
2.0.0-p0
Backport:
[ruby-core:52935]

Description

=begin
1.9.3p385 :001 > "\xc3\x28".encode('UTF-8', 'UTF-8', invalid: :replace) =~ /\s/
=> nil

2.0.0-p0 :001 > "\xc3\x28".encode!('UTF-8', 'UTF-8', invalid: :replace) =~ /\s/
ArgumentError: invalid byte sequence in UTF-8
from (irb):1
from /Users/max/.rvm/rubies/ruby-2.0.0-p0/bin/irb:16:in `'
=end


Related issues

Related to Ruby master - Feature #6321: Find and repair bad bytes in encodings, without transcodingClosed04/19/2012Actions
Related to Ruby master - Feature #6752: Replacing ill-formed subsequencceClosed07/19/2012Actions

Associated revisions

Revision 1e8a05c1
Added by naruse (Yui NARUSE) over 6 years ago

Add example for String#scrub

[Feature #6321] [Feature #6752] [Bug #7967]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 40391
Added by naruse (Yui NARUSE) over 6 years ago

Add example for String#scrub

[Feature #6321] [Feature #6752] [Bug #7967]

Revision 40391
Added by naruse (Yui NARUSE) over 6 years ago

Add example for String#scrub

[Feature #6321] [Feature #6752] [Bug #7967]

Revision 40391
Added by naruse (Yui NARUSE) over 6 years ago

Add example for String#scrub

[Feature #6321] [Feature #6752] [Bug #7967]

Revision 40391
Added by naruse (Yui NARUSE) over 6 years ago

Add example for String#scrub

[Feature #6321] [Feature #6752] [Bug #7967]

Revision 40391
Added by naruse (Yui NARUSE) over 6 years ago

Add example for String#scrub

[Feature #6321] [Feature #6752] [Bug #7967]

Revision 40391
Added by naruse (Yui NARUSE) over 6 years ago

Add example for String#scrub

[Feature #6321] [Feature #6752] [Bug #7967]

History

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Open to Rejected

String#encode does nothing when source and destination encodings are same.

Also available in: Atom PDF