I have some code in 1.8 that would strip certain special characters out
of a string (escape sequences in Telnet specifically, such as
\377\373\001).

I've moved to 1.9 and now that code fails with "invalid multibyte
escape".

I've looked at some of the tutorials regarding encodings in 1.9 and to
be honest I find them very intimidating.  I'm hoping someone can suggest
a quick fix?

Here's the code:

[3,4,5,6,7].each do |n|
    line.gsub!(/#{('\377\37' + n.to_s + '\001')}/,"")
end

Many thanks in advance!

 - Andrew

-- 
Posted via http://www.ruby-forum.com/.