Created
December 17, 2009 04:07
-
-
Save panfu/258516 to your computer and use it in GitHub Desktop.
关于encode的那些事儿
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cgi' | |
require 'uri' | |
r =<<JS | |
{ | |
"max_character_length": '140', | |
"mouseover_active": false, | |
"hovering_delay": 1000, | |
"translations": { | |
"button_change": "Change", | |
"button_save": "Save", | |
"button_saving": "Saving...", | |
"button_saved": "Saved", | |
"failure_message": "Failed", | |
"hint_text": "What's up?" | |
}, | |
"url": "?m=Profile&func=process_set_status&ajax=1&store=0&ajax_target=canvas", | |
"post_params": { | |
"viewer_id": 67042802, | |
"csrf": "5a7e980a" | |
}, | |
"new_status_param_name": "status_body" | |
} | |
JS | |
# p CGI.escape(r) | |
puts e = CGI::escapeHTML(r.gsub(/\t|\n/, '')) | |
puts CGI::unescapeHTML(e) | |
# p URI.escape(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment