Guest User

Untitled

a guest
Jul 6th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. convert unicode into character with ruby
  2. p "国".unpack("U*").first #this gives the unicode 22269
  3.  
  4. [22269].pack('U*') #=> "国" or "345233275"
  5.  
  6. p "国".codepoints.first #=> 22269
  7. p 22269.chr('UTF-8') #=> "国"
Advertisement
Add Comment
Please, Sign In to add comment