Weird character downcasing issue


#1

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

#2

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

#3

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

#4

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

#5

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