I use Ruby 1.86 on a Macintosh with Leopard.

I wrote a script that looks for a particular regular expression in a
large body of text, retrieves, sorts the hits, and prints them out to a
file defined as outfile with the command outfile.print. The scripts were
written with Textmate and saved to the default MacRoman character set

This has always worked. But I needed to look for a non-alphabetical
Unicode character. So I saved the script as a UTF-8 file and ran Ruby
with the -Ku option. Oddly enough, the program terminates with the error
message "undefined local variable or method `outfile' for main:Object
(NameError)"

If instead of printing the output to a file I send it to STDOUT the
program works. If I run the program without the -Ku option I get the
error message "Invalid char `\357' in expression", which I presume is a
complaint  about the Unicode character in the regular expression.

If I remove the Unicode character and run the program with some other
regular expression, the program runs properly and recognizes the
outfile.print command.

Is this a bug or is there something obvious I overlooked?
-- 
Posted via http://www.ruby-forum.com/.