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.
A91bd6cef23eb3516245a092e196c4da?d=identicon&s=25 Maurício Linhares (mauricio)
on 2009-01-23 14: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
B2625ae7fa60dce7697771ca1ef57444?d=identicon&s=25 Paweł Wielgus (Guest)
on 2009-01-23 14: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 <mauricio.linhares@gmail.com>:
> 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
A91bd6cef23eb3516245a092e196c4da?d=identicon&s=25 Maurício Linhares (mauricio)
on 2009-01-23 14: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 <poulwiel@gmail.com>:
> 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
40613e55d7082e5f08429dfb50d0680e?d=identicon&s=25 Stefan Lang (Guest)
on 2009-01-26 16:24
(Received via mailing list)
2009/1/23 Maurício Linhares <mauricio.linhares@gmail.com>:
> 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
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-01-27 23:38
(Received via mailing list)
Stefan Lang 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.