Skip to content

Instantly share code, notes, and snippets.

@freels
Created March 17, 2009 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freels/80844 to your computer and use it in GitHub Desktop.
Save freels/80844 to your computer and use it in GitHub Desktop.
i tried to escape html in ruby
a task that has proved quite too easy
so i dusted off perl
and gave it a whirl:
while(<>){s/([<>'"&])/sprintf('&#%d;',ord($1))/eg;print;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment