Howto create a charactere in utf-16

for respond to [FATAL] failed to allocate memory - Ruby - Ruby-Forum topics,
I would like put integer value in string (for store enormous array of
short in memory).

it’s seem that Integer.chr(“UTF-16”) do not accept value
greater than 255.

Is there another way to create char/string with code-point value ?

Regis d’Aubarede wrote in post #1153717:

Is there another way to create char/string with code-point value ?

Oups, I got it…

irb(main):007:0> puts [29166].pack(“U”)

=> nil

If you switch to ruby 2.1, Integer#chr() will work on larger integers.