I have a requirement in which I want to dynamically create a Unicode string using interpolation. see the following code verified in irb
2.1.2 :016 > hex = 0x0905
=> 2309
2.1.2 :017 > b = "\u#{hex}"
SyntaxError: (irb):17: invalid Unicode escape
b = "\u#{hex}"
Hex code 0x0905 corresponds to unicode for an independent vowel for DEVANAGARI LETTER A.
I can’t understand how to achieve the desired result.
source
share