Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
RegexpError: invalid multibyte character #2528
Seeing the following error when attempting to run
1.9.3-p547 :001 > str = 9999.to_s => "9999" 1.9.3-p547 :002 > str.encoding => #<Encoding:US-ASCII> 1.9.3-p547 :003 > str.sub("¥", "") => "9999"
jruby-1.7.18 :002 > str = 9999.to_s => "9999" jruby-1.7.18 :003 > str.encoding => #<Encoding:US-ASCII> jruby-1.7.18 :005 > str.sub("¥", "") RegexpError: invalid multibyte character: /Â¥/ from org/jruby/RubyString.java:2817:in `sub!' from org/jruby/RubyString.java:2777:in `sub' from (irb):5:in `evaluate' from org/jruby/RubyKernel.java:1107:in `eval' from org/jruby/RubyKernel.java:1507:in `loop' from org/jruby/RubyKernel.java:1270:in `catch' from org/jruby/RubyKernel.java:1270:in `catch' from /Users/nb/.rvm/gems/jruby-1.7.18/bundler/gems/rails-fc40cbbc4aaa/railties/lib/rails/commands/console.rb:110:in `start' from /Users/nb/.rvm/gems/jruby-1.7.18/bundler/gems/rails-fc40cbbc4aaa/railties/lib/rails/commands/console.rb:9:in `start' from /Users/nb/.rvm/gems/jruby-1.7.18/bundler/gems/rails-fc40cbbc4aaa/railties/lib/rails/commands/commands_tasks.rb:68:in `console' from /Users/nb/.rvm/gems/jruby-1.7.18/bundler/gems/rails-fc40cbbc4aaa/railties/lib/rails/commands/commands_tasks.rb:39:in `run_command!' from /Users/nb/.rvm/gems/jruby-1.7.18/bundler/gems/rails-fc40cbbc4aaa/railties/lib/rails/commands.rb:17:in `(root)' from org/jruby/RubyKernel.java:1071:in `require' from script/rails:1:in `(root)'
JRuby version info:
jruby-1.7.18 :006 > `jruby -v` => "jruby 1.7.18 (1.9.3p551) 2014-12-22 625381c on Java HotSpot(TM) 64-Bit Server VM 1.8.0-b132 [darwin-x86_64]\n"
This is relevant as it manifests itself in the Ruby Money gem at the following location:
cherry-picked to master. Closing. For posterity MRI does not use regexps for string subs and has this dual-use loop where search and replace code is calls either regexp or string stuff. It was pretty invasive to do it that way and it seemed kind of difficult to follow.