Q:

ruby assign hex value to string

This code is working on the older versions   1.8.X 
 @buff1 = "12"
 @buff1[0] = 0x0b                                   
 @buff1[1] = 0x0e

I have udpated small part of code . Please have a look again. because in 1.8.6 I get "\016\v"  as output and in 1.9.3 showing error TypeError: can't convert Fixnum into String
Please provide solution for 1.9.3

A:

It works in Ruby 1.9.3
p RUBY_VERSION
b = "12"
@buff1 = []
@buff1[0] = 0x0b                                   
@buff1[1] = 0x0e
p @buff1

Output:
"1.9.3"
[11, 14]

Probably you tried:
p RUBY_VERSION
b = "12" # you missed the statement @buff1 = []
@buff1[0] = 0x0b                                   
@buff1[1] = 0x0e
p @buff1

And you got the below output:
"1.9.3"
C:/Documents and Settings/rakshiar/My Documents/userdata/Ruby/Scripts/test.rb:11
9:in `<main>': undefined method `[]=' for nil:NilClass (NoMethodError)

Hope this code will help you.
UPDATE
p RUBY_VERSION
@buff1 = "12"
@buff1[0] = 0x0b.to_s  
p @buff1                               
@buff1[1] = 0x0e.to_s
p @buff1

Output:
"1.9.3"
"112"
"1142"

