0

Is there any way other than using 'eval'?

s = '"\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E"'
puts eval s
Zephyr Dodolee
  • 193
  • 1
  • 7
  • You can guard against bad strings with a simple regex, in which case an `eval` is a lot less risky. A very similar regex would give you the hex codes direct and you could `unpack` them. – Neil Slater Apr 11 '14 at 14:50
  • See this answer: http://stackoverflow.com/a/22090177/1120015 – Uri Agassi Apr 11 '14 at 15:28

0 Answers0