public
Created

match and UTF-8

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12
ruby-1.9.2-p290 :008 > line="Welcome to leguin.freenode.net in Ume\xE5, Sweden, EU!"
=> "Welcome to leguin.freenode.net in Ume\xE5, Sweden, EU!"
 
ruby-1.9.2-p290 :011 > line.encoding
=> #<Encoding:UTF-8>
 
ruby-1.9.2-p290 :010 > /^$/.match("abc")
=> nil
 
ruby-1.9.2-p290 :009 > /^$/.match(line)
ArgumentError: invalid byte sequence in UTF-8
from (irb):9:in `match'

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.