From: Dmitrii Dimandt Date: 2006-06-28T15:22:52+09:00 Subject: Re: Unicode roadmap? On 6/28/06, Patrick Hurley wrote: > On 6/27/06, Berger, Daniel wrote: > > > > I'm sure there are *many* people using character access in "real world" > > code. > > Raising my hand, but the question might be who does character access > on _Unicode_ strings. I play with byte arrays all the time (sometimes > with embedded strings), but very rarely (but I do) use string slicing > against a Unicode string. > I guess, that would be anyone in East Europe with Cyrillic-based alphabets :) Especially those dealing with web apps. *Sigh* On the other hand, I wonder, who in his right mind would want to work with _strings_ as with a sequence of bytes? ;-) 90% of developers out there don't even know how encodings work. So all this manual to and fro conversion, moving through bytes etc. etc. would only be perceived as vodoo magic. *A deeper sigh* > I am in the (unfortunate) position of dealing with many legacy binary > files, encoded into a wide variety of pieces and parts -- I use string > slicing, but more exactly I use byte array slicing (don't get me wrong > -- I want to keep a single String class). > I wonder, what is wrong with making all strings Unicode by default (this will ensure that most libraries don't automagically break once Ruby is upgraded), _but_ let developers optionally decide whether they want a different encoding: s = new String #=> unicode string sj = new String(:encoding => 'jis') scp = new String(:encoding => 'CP1251') sb = new String(:binary => true) #=> work as ByteArray sbf = new String(:encoding => 'funny encoding', :binary => true) #=> work as ByteArray There are numerous performance issues, I suppose. And other problems like assignment operations. *Sigh*