[rspec-devel] Ruby 1.8 does allow non-ascii method names in the source

aslak hellesoy aslak.hellesoy at gmail.com
Mon Feb 9 06:07:20 EST 2009


On Sun, Feb 8, 2009 at 10:46 PM, Marcello Nuccio
<marcello.nuccio at gmail.com> wrote:
> Sorry if this is a dupe, but I think the first delivery failed...
>
> In cucumber History.txt I read:
> * Given, When, Then are automatically aliased to current language.
>  Ruby 1.8 doesn't allow non-ascii method names in the source, so
> unless you're on 1.9
>  you will have to use Given, When, Then or set up your own aliases.
> Here is Norwegian:
>   Cucumber.alias_steps(%w{Naar Saa}) # Når, Så already aliased, but
> can't be called. (Aslak Hellesøy)
>
> I think this is not true.  On my computer (Ubuntu 8.10):
>
> $ ruby --version
> ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
> $ file prova.rb
> prova.rb: UTF-8 Unicode C++ program text
> $ cat prova.rb
> class Facoltà
>  CÌÈÒÉÙÀ = :çèéù
>
>  def self.àèìòù
>   @sì_o_no = CÌÈÒÉÙÀ
>  end
> end
>
> puts Facoltà.àèìòù
> $ ruby -Ku prova.rb
> çèéù
>
>
> I can use UTF-8 characters in class, method, variable, and constant names.
> I use this feature in rails to have model, attributes, and controller
> names with non-ascii characters.  You need a small rails patch, but it
> works fine for me.
>

You are absolutely right Marcello. I made this incorrect conclusion in
a moment where I had forgotten about -Ku and $KCODE='u'.
Fixed: http://github.com/aslakhellesoy/cucumber/commit/12ea5d13922ecffe8f9521bf5d6192992a60e5e5

Aslak

> cheers,
>  Marcello Nuccio
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>



-- 
Aslak (::)


More information about the rspec-devel mailing list