Changing non-standard ASCII character casing (UTF-8)

I’m looking for some information on changing the casing of non-standard
ASCII
UTF-8 characters in JRuby.

In MRI, it appears the unicode gem is the recommended approach for this:
http://ideaharbor.org/notes/technical/working-with-unicode-in-ruby/

Is there a recommended approach in JRuby?

Matthew


View this message in context:
http://www.nabble.com/Changing-non-standard-ASCII-character-casing-(UTF-8)-tp24186964p24186964.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Fortunately I’ve discovered a way to do this. Unfortunately it requires
explicit use of Java.

s = “Café”
=> “Café”
s.upcase
=> “CAFé”
s.to_java_string.to_upper_case
=> “CAFé”
java.lang.String.new(s).to_upper_case
=> “CAFÉ”

It’s intriguing that converting from a Ruby to a Java String does not
behave
the same way as creating a Java String.
Furthermore;

s.to_java_string.to_s
=> “Café”

Suggests that the encoding of the converted String is incorrect.

Regards,

Matthew Ueckerman

Matthew Ueckerman wrote:


View this message in context:
http://www.nabble.com/Changing-non-standard-ASCII-character-casing-(UTF-8)-tp24186964p24216311.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email