Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3437 from k77ch7/fix_GH-3402
Fix for issue 3402: String#encode with :replace option does not return correct value
- Loading branch information
Showing
2 changed files
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# coding: utf-8 | ||
|
||
require 'rspec' | ||
|
||
# https://github.com/jruby/jruby/issues/3402 | ||
describe 'String#encode with :replace option' do | ||
it 'returns correct value' do | ||
str = "testing\xC2".encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "foo123") | ||
expect(str).to eq "testingfoo123" | ||
end | ||
end | ||
|