I'm trying to run a Ruby script, and always getting an error on this line:
file_content.gsub(/dr/i,'med')
Where I'm trying to replace "dr" by "med".
The error is:
program.rb:4:in `gsub': invalid byte sequence in UTF-8 (ArgumentError)
Why is that, how can I fix this issue?
I'm working on a MAC OS X Yosemite machine, with Ruby 2.2.1p85.
Probably your string is not in UTF-8 format, so use
See "Ruby 2.0.0 String#Match ArgumentError: invalid byte sequence in UTF-8".