Forum: Ruby Special UTF8 characters as methods in ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B1635a1aa53526670d394025f8885f41?d=identicon&s=25 Six (Guest)
on 2008-11-11 23:11
(Received via mailing list)
I'm trying to figure out how to define as a method a special math
symbol:

def  – num  # Not seeing the square root symbol after def here?
Wouldn't surprise me.
  Math.sqrt num
end

-- but ruby gives me the error:
:3: Invalid char `\342' in expression
:3: Invalid char `\210' in expression
:3: Invalid char `\232' in expression
Program exited.

I know there is a way to do this and I've looked for a couple days but
can't seem to re-find it. Anyone ever gotten this to work; if so, how?
B1635a1aa53526670d394025f8885f41?d=identicon&s=25 Six (Guest)
on 2008-11-11 23:35
(Received via mailing list)
Nevermind, figured it out.

Note to self:

$KCODE = "UTF-8"
ruby -Ku script_with_funky_chars

Pardon the bother.
This topic is locked and can not be replied to.