[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby 1.9 and unicode

Marcin Raczkowski

1/15/2008 3:50:00 PM

Well i tried to play a little with new unicode features.


i wanted to do something like this:

def Σ(*args)
args.inject(0){|sum,el| sum+el}
end

and use it like Σ[1,2,3,4]

BUT:

swistak@sreberko:~$ irb1.9
irb(main):001:0> # -*- encoding: utf-8 -*-
irb(main):002:0* Σ(1,2,3)
=> nil
swistak@sreberko:~$

--------------------------

swistak@sreberko:~$ irb1.9
irb(main):001:0> def Σ(*args)
SyntaxError: compile error
(irb):1: syntax error, unexpected $end
from (irb):1:in `Kernel#binding'
swistak@sreberko:~$

-------------------------
as you can see it's droping back to shell after i type unicode character in.

I'm using Debian etch. Gnome + gnome terminal.

Any ideas?

2 Answers

Tiziano Merzi

1/15/2008 5:03:00 PM

0

Marcin Raczkowski wrote:
> Well i tried to play a little with new unicode features.
>
>
> i wanted to do something like this:

> Any ideas?

I try with netbeans and from command in windows: it works!
But not with irb.

You ca try with a script and run the script with ruby interpreter

tiziano
--
Posted via http://www.ruby-....

Marcin Raczkowski

1/15/2008 8:44:00 PM

0

Tiziano Merzi wrote:
> Marcin Raczkowski wrote:
>> Well i tried to play a little with new unicode features.
>>
>>
>> i wanted to do something like this:
>
>> Any ideas?
>
> I try with netbeans and from command in windows: it works!
> But not with irb.
>
> You ca try with a script and run the script with ruby interpreter
>
> tiziano

Strange, anyone can confirm that behavior? mayby some compiler flags ?