rubystringencodingdecodestring-decoding

Ruby: How to decode strings which are partially encoded or fully encoded?


I am getting encoded strings while parsing text files. I have no idea on how to decode them to english or it's original language.

  "info@cloudag.com"

is the encoded string and needs to have it decoded.

I want to decode using Ruby.

Here is a link for your reference and I am expecting the same.


Solution

  • This looks like HTML encoding, not URL encoding.

    require 'cgi'
    
    CGI.unescapeHTML("info@cloudag.com")
    #=> "info@cloudag.com"