From: Charles Nutter Date: 2011-01-29T10:35:18+09:00 Subject: [ruby-core:34964] [Ruby 1.9-Bug#4340] Encoding of result string for String#gsub is not consistent Issue #4340 has been updated by Charles Nutter. Your beginning-of-string substitutions don't use the "hi" variable in either case. It doesn't affect the result, though. JRuby behaves differently, apparently using the pattern's encoding in gsub and the original's encoding in sub (and our pattern's encoding is wrong due to other issues). ~/projects/jruby ��� jruby --1.9 t.rb using gsub "Hello Everybody!" # "Hi World!" # using sub "Hello Everybody!" # "Hi World!" # Filed: http://jira.codehaus.org/browse/JRUBY-5437 ---------------------------------------- http://redmine.ruby-lang.org/issues/show/4340 ---------------------------------------- http://redmine.ruby-lang.org