On 9/23/06, Sam Ruby <[EMAIL PROTECTED]> wrote: > How does JRuby handle strings? If they are mapped to java.lang.String, > the JRuby already has more than adequate Unicode support.
JRuby does use java.lang.String, but we have to artificially downgrade everything to a single-byte encoding for Ruby's sake. Because there's no concept of characters versus bytes in Ruby, we can't really support multiybyte characters or code points or what have you without creating incompatible interfaces. It's a source of great frustration for us, so much so that we're probably just going to create some incompatibilities to solve the Unicode issue on our end. It's likely that in the future all strings in JRuby will be UTF-16 strings as in Java, and all operations will deal in characters instead of bytes whereever possible. We'll deal with issues that arise as they come up, such as for handling IO that wants byte counts when we're providing character counts. > > It seems to me that .chars should return back the same object, if the > underlying VM supports Unicode. I would guess that today that would > include JRuby, and in the future, that would include Ruby 2.0. chars would be easy to implement today; and really we may look at the ActiveSupport::MultiByte way to handle Unicode as "the one way" we also do it in JRuby. Rails is driving Unicode innovation at this point, so if this sees wider adoption we're not opposed to including it in core JRuby. To be absolutely clear: we want to support Unicode natively in JRuby, and we're really just looking to the community to decide what form that should take. If there's something that can be done within Ruby 1.8-semantics that works with Ruby 1.8-compatible apps, we'll include it. -- Contribute to RubySpec! @ www.headius.com/rubyspec Charles Oliver Nutter @ headius.blogspot.com Ruby User @ ruby.mn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
