Ruby 1.9 and unicode

Discussion in 'Ruby' started by Marcin Raczkowski, Jan 15, 2008.

  1. 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?
     
    Marcin Raczkowski, Jan 15, 2008
    #1
    1. Advertising

  2. 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-forum.com/.
     
    Tiziano Merzi, Jan 15, 2008
    #2
    1. Advertising

  3. 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 ?
     
    Marcin Raczkowski, Jan 15, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Mark Bram
    Replies:
    0
    Views:
    3,965
    Robert Mark Bram
    Sep 28, 2003
  2. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    986
    Grzegorz ¦liwiñski
    Jan 19, 2011
  3. Mike McGavin

    Unicode in Ruby and a Ruby Reference

    Mike McGavin, Dec 14, 2004, in forum: Ruby
    Replies:
    9
    Views:
    108
    Alexander Kellett
    Dec 15, 2004
  4. Chirag Mistry
    Replies:
    6
    Views:
    176
    Ollivier Robert
    Feb 8, 2008
  5. Terry Reedy
    Replies:
    0
    Views:
    78
    Terry Reedy
    Jan 7, 2014
Loading...

Share This Page