Ruby pack - TypeError: can't convert String into Integer

I’ve no idea what you’re trying to do here, but the underlying cause is that on ruby 1.8.7:

‘123’[0] #=> 49, the byte value of the first character

but on ruby 1.9.3

‘123’[0] #=> ‘1’, a string of length 1 beginning at the specified offset

Fred