Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String.encode :replace option does not work when encoding to UTF8 #3402

Closed
brianstien opened this issue Oct 20, 2015 · 0 comments
Closed

String.encode :replace option does not work when encoding to UTF8 #3402

brianstien opened this issue Oct 20, 2015 · 0 comments

Comments

@brianstien
Copy link

@brianstien brianstien commented Oct 20, 2015

Reproduction

ruby -e 'puts "testing\xC2".encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "foo123")'

MRI behavior (2.2.3)

2.2.3 :001 > "testing\xC2".encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "foo123")
 => "testingfoo123"

JRuby behavior (9.0.1.0)

jruby-9.0.1.0 :001 > "testing\xC2".encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "foo123")
 => "testing�"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.