StringScanner using skip_until not detecting special characters

I am trying to parse a string until the first occurrence of a word. This
word sometimes has non latin characters in it and it has been causing me
problems.

An example:

irb(main):001:0> require ‘strscan’
=> true
irb(main):002:0> testStr = “There is a special name, André, in it”
=> “There is a special name, Andr\303\251, in it”
irb(main):004:0> s = StringScanner.new(testStr)
=> #<StringScanner 0/38 @ “There…”>
irb(main):005:0> s.skip_until /special/
=> 18
irb(main):008:0> s.skip_until /André/
=> nil

Thanks for any help

–output:–
1.8.7
18
13

–output:–
1.8.6
18
13

The lesson: don’t ever run anything in irb.

Brendan F. wrote in post #1011953:

I am trying to parse a string until the first occurrence of a word. This

#encoding: utf-8
require ‘strscan’

puts RUBY_VERSION

testStr = “There is a special name, André, in it”
s = StringScanner.new(testStr)

index = s.skip_until /special/
puts index

index = s.skip_until /André/
puts index

–output:–
1.9.2
18
13