From: Scott Gonyea Date: 2010-10-12T08:12:09+09:00 Subject: Re: Ruby 1.9.2: How to sanitize text with invalid characters? Will this work? blah1 = "#{0xFF.chr} abcde" blah2 = blah.split(/[^[:print:]]/).join On Mon, Oct 11, 2010 at 4:03 PM, Andreas S. wrote: > Scott Gonyea wrote in post #949026: >> Code / Data samples? > > Trivial example: > "#{0xFF.chr} abcde".force_encoding("utf-8").gsub(/a/,'') > ArgumentError: invalid byte sequence in UTF-8 > -- > Posted via http://www.ruby-forum.com/. > >