odd behaviour of a script when using -Ku option

M

Martin Mueller

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top