From: "Andreas S." Date: 2010-10-12T06:08:00+09:00 Subject: Ruby 1.9.2: How to sanitize text with invalid characters? I process a lot of text files of which I know the encoding, but that might contain a few bytes that are invalid (i.e., make gsub fail with "ArgumentError: invalid byte sequence in US-ASCII/UTF8"). What's the best way to handle this situation gracefully, by ignoring or removing the invalid characters? -- Posted via http://www.ruby-forum.com/.