From: Austin Ziegler Date: 2006-10-19T09:59:08+09:00 Subject: Re: Bitwise operations On 10/18/06, David Vallner wrote: > Gavin Kistner wrote: > > Strings in Ruby are, as you say, series of 8-bit bytes. The String#[] > > operator when called with a single integer index returns the numeric > > value of the requested byte: > Reputedly about to change in Ruby 2, indexing a String will return a > single-character string. I think there'll be some more clean separation > between methods operating on a String as a (possibly Unicode) text > string or as binary data. I'm still personally not quite happy with the > semantics of Strings being overloaded like this, but it's probably the > most compatible way. Fortunately, it will be controlled where the encoding of the binary blob that is the string is treated as a view on the data. Thus, when the encoding is UTF-8, Ruby will try to interpret the characters according to UTF-8 rules. When the encoding is none (or raw, or something), Ruby won't try to interpret the characters at all. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca