Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 1.6RC3
-
Component/s: Ruby 1.9.2
-
Labels:None
-
Number of attachments :
Description
Executing this script from a ruby file we raise an error but it should work:
p 'foo'.gsub(/[\x00-\x20%\x7F-\xFF]/, '')
org/jruby/RubyString.java:2843:in `gsub19': invalid multibyte escape: /[\x00-\x20%\x7F-\xFF]/ (RegexpError) from org/jruby/RubyString.java:2811:in `gsub19' from t.rb:3:in `(root)'
Be aware that the same error from the command line or irb is fine because of the encoding. I guess ruby takes the file encoding from the system and propagates it to the regular expression.
Btw, this bug causes 74 ActiveSupport tests fail.