Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- convert unicode into character with ruby
- p "国".unpack("U*").first #this gives the unicode 22269
- [22269].pack('U*') #=> "国" or "345233275"
- p "国".codepoints.first #=> 22269
- p 22269.chr('UTF-8') #=> "国"
Advertisement
Add Comment
Please, Sign In to add comment