Ruby hexacode to unicode conversion -


I have crawled a website that has Unicode, the result looks something like this, in the code < P> a = "\\ u2665 \\ uc624 \\ ube60! \\ uc8fd \\ uae30 \\ uc804 \\ uc3d0"

How do I convert it to root Unicode in Ruby ? Text which is in UTF-8 format?

If you have Ruby 1.9, then you can try:

  a.force_encoding ('UTF-8')   

Otherwise if you have & lt; 1.9, I suggest converting to Ruby 1.8 in UTF-8.

Comments