Ruby: create a String from bytes
can't remember if there is a single function that does that:
>> a = [65,66,67]
=> [65, 66, 67]
>> a.map {|x| x.chr}.join
=> "ABC"
for 1.9 you need:
[195,164].pack('c*').force_encoding('UTF-8')
There is a much simpler approach than any of the above: Array#pack:
>> [65,66,67,68,69].pack('c*')
=> "ABCDE"
I believe pack is implemented in c in matz ruby, so it also will be considerably faster with very large arrays.
Also, pack can correctly handle UTF-8 using the 'U*' template.