Hi --

On Mon, 27 Jul 2009, Kless wrote:

> I want to stick raw bytes (0-255) into a variable.
>
> This will work in Ruby 1.8 since that it always assumes that the
> characters in strings are exactly bytes. But I'm not sure about Ruby
> 1.9 as it has per-string character encodings.

In 1.9 you can iterate through strings by line, byte, character, or
codepoint. I'm not sure exactly what you want to do but have a look at
String#bytes (aka #each_byte).


David

-- 
David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
Q: What's the best way to get a really solid knowledge of Ruby?
A: Come to our Ruby training in Edison, New Jersey, September 14-17!
    Instructors: David A. Black and Erik Kastner
    More info and registration: http://rubyurl.com/vmzN