Skip to content

Instantly share code, notes, and snippets.

@glurp
Created January 21, 2014 19:48
Show Gist options
  • Select an option

  • Save glurp/8547020 to your computer and use it in GitHub Desktop.

Select an option

Save glurp/8547020 to your computer and use it in GitHub Desktop.
here the diff betwen original data read from file and the data sended by
web browser when save the textarea content (send by jquery,
in application/x-www-form-urlencoded) form :
>diff webserver.rb webserver.rb1
145c145
< when String then (a !~ /"/) && '"'+a+'"' || "'"+a.gsub(/'/,'\\'+"'")+"'"
---
> when String then (a !~ /"/) && '"'+a+'"' || "'"+a.gsub(/'/,'\'+"'")+"'"
496c496
< string.gsub(/&/n, '&amp;').gsub(/\"/n, '&quot;').gsub(/>/n, '&gt;').gsub(/</n, '&lt;')
---
> string.gsub(/&/n, '&amp;').gsub(/__TEXT__quot;/n, '&quot;').gsub(/>/n, '&gt;').gsub(/</n, '&lt;')
756c756
< def meta(h)
---
> def meta(h)
1224c1224
< # gsub('\\','\\\\')
---
> # gsub('\','\\')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment