Skip to content

Instantly share code, notes, and snippets.

@doomspork
Created May 30, 2015 20:00
Show Gist options
  • Save doomspork/f4e073570cda3f882365 to your computer and use it in GitHub Desktop.
Save doomspork/f4e073570cda3f882365 to your computer and use it in GitHub Desktop.
{:ok, file} = File.open 'test.txt', [:write]
escaped = "foo&quote;bar's"
|> String.replace("&quote;", "\"")
|> String.replace("'", "'")
|> String.replace("&", "&")
file
|> IO.binwrite(escaped)
|> File.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment