Given a hex code, for example: 1f60d
, how do I find the corresponding unicode (code point) 😍
?
You could do that by using Array#pack
:
["1F60d".to_i(16)].pack("U*")
Convert the string to an integer (e.g. via hex
) and the integer to a character via chr
:
'1f60d'.hex.chr('UTF-8')
#=> "😍"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With