Bug #562: String#encode Behaving Like String#encode!
http://redmine.ruby-lang.org/issues/show/562

Author: James Gray
Status: Open, Priority: Normal
Category: M17N

String#encode is changing the original String in the version of Ruby I built yesterday:

$ cat bug.rb 
#!/usr/bin/env ruby -w
# encoding: UTF-8

a = "James"
b = a.encode("SJIS")
p a.encoding
p b.encoding
$ ruby_dev bug.rb 
#<Encoding:Shift_JIS>
#<Encoding:Shift_JIS>

James Edward Gray II


----------------------------------------
http://redmine.ruby-lang.org