I have some content (html) that is being encoded as a result of this javascript (from this page) and sent to my rails application:
function encode_utf8_b64(string) {
return window.btoa(unescape(encodeURIComponent(string)));
}
The correspond js code to get it back to original is this:
function decode_utf8_b64(string) {
return decodeURIComponent(escape(window.atob(string)));
}
My question is, is there an equivalent in ruby of decodeURIComponent()? So far I have this that gets it part of the way out, but I'm missing the last step of decodeURIComponent:
CGI::escape(Base64.decode64(string))