1. How does performance look with the unicode string add-on versus native strings?
2. Is this the ideal way to support unicode strings in ruby?
And I explain the second as follows....if we could assume that switching from treating a string as an array of bytes to a list of characters of arbitrary width, and have all existing string operations work correctly treating those characters as string, would that be a better ideal? Where are the breaking points in such a design? What's to stop the underlying implementation from actually using a UTF-16 character, passing UTF-8 to libraries and IO streams but still allowing you to access everything as UTF-16 or your encoding of choice? (Of course this is somewhat rhetorical; we do this currently with JRuby since Java's scrints are UTF-16...we just don't have any way to provide access to UTF-16 characters, and we normalize everything to UTF-8 for Ruby's sake...but what if we didn't normalize and adjusted string functions to compensate?)
On 6/14/06, Manfred Stienstra <[EMAIL PROTECTED]> wrote:
On Jun 15, 2006, at 2:19 AM, Charles O Nutter wrote:
> I posted this to ruby-talk, but it occurred to me that you folks
> implementing Rails functionality probably have a thing or two to
> say about unicode support in Ruby. Therefore, I would love to hear
> your opinions. Adding native unicode support is only a matter of
> time in JRuby; its usefulness as a JVM-based language depends on
> it. However, we continue to wrestle with how best to support
> unicode without stepping on the Ruby community's toes in the
> process. Thoughts?
Julik has done a lot of pionering in that direction for Rails. His
latest suggestion is to use a proxy class on string objects to
perform unicode operations:
@some_unicode_string.u.length
@some_unicode_string.u.reverse
I tend to agree with this solution as it doesn't break any previous
string operations and gives us an easy way to perform unicode aware
operations.
Manfred
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core
--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com
_______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core