Forum: JRuby Weird character downcasing issue

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.
Maurício L. (Guest)
on 2009-01-23 15:04
(Received via mailing list)
Hi guys.

Anyone knows why if I try this:

"Ö".downcase

I get this:

=> "\303\226"

In pure Java:

"Ö".toLowerCase()

Yields the correct result.

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Paweł Wielgus (Guest)
on 2009-01-23 15:19
(Received via mailing list)
Hi Maurício,
those are two different methods and two different objects:

java.lang.String.toLowerCase()
and
ruby String.donwcase

As far as i know jruby should be consistent with ruby but not with java
i think.
What You can try is:

java.lang.String("Ö").toLowerCase() in jruby,
but i was having some issues with that some time ago, You can search
the list for it.

Best greetings,
Pawe³ Wielgus.


2009/1/23 Maurício Linhares <removed_email_address@domain.invalid>:
> In pure Java:
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Maurício L. (Guest)
on 2009-01-23 15:24
(Received via mailing list)
I guessed that even being two different methods, both should work the
same way, as both have the same "idea".

But yes, MRI yields the same result, it just doesn't feel right.

Is this fixed on 1.9? If run JRuby with 1.9 would it work as expected?

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)



2009/1/23 Pawe³ Wielgus <removed_email_address@domain.invalid>:
> java.lang.String("Ö").toLowerCase() in jruby,
> but i was having some issues with that some time ago, You can search
> the list for it.
>
> Best greetings,
> Pawe³ Wielgus.
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Stefan L. (Guest)
on 2009-01-26 17:24
(Received via mailing list)
2009/1/23 Maurício Linhares <removed_email_address@domain.invalid>:
> I guessed that even being two different methods, both should work the
> same way, as both have the same "idea".
>
> But yes, MRI yields the same result, it just doesn't feel right.
>
> Is this fixed on 1.9? If run JRuby with 1.9 would it work as expected?

Both, Ruby 1.8 and Ruby 1.9, upcase/downcase by definition
recognize only ASCII characters. I've written a library (Ruby 1.9 only!)
that provides full upcase/downcase and other Unicode algorithms:
http://unicode-utils.rubyforge.org/

JRuby 1.1.6 has not enough 1.9 support for it to work though.

Stefan

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Charles Oliver N. (Guest)
on 2009-01-28 00:38
(Received via mailing list)
Stefan L. wrote:
> Both, Ruby 1.8 and Ruby 1.9, upcase/downcase by definition
> recognize only ASCII characters. I've written a library (Ruby 1.9 only!)
> that provides full upcase/downcase and other Unicode algorithms:
> http://unicode-utils.rubyforge.org/
>
> JRuby 1.1.6 has not enough 1.9 support for it to work though.

Hopefully we will soon. Until then the suggestion about
java.lang.String.new("Ö").toLowerCase() is certainly an option.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.