From: Wayne Brissette Date: 2013-01-08T20:08:40+09:00 Subject: Re: gsub with multibyte characters On Jan 8, 2013, at 1:13 AM, Harry Kakueki wrote: > On Tue, Jan 8, 2013 at 7:58 AM, Wayne Brisette wrote: >> I'm running into a problem trying to read a line of text that has some multibyte >> characters gsub is failing. Is there a trick to finding and replacing multibyte >> characters? >> > > Do you have something like this as the first line of your code? > > # encoding: UTF-8 > I have added this but when I do, I end up with 'gsub!: Invalid byte sequence in UTF-8 (ArgumentError). Ironically if I use macruby's irb, I can do the gsub without any problems. Why would macruby allow this, but not the MRI version of Ruby? Wayne