Skip to content

Instantly share code, notes, and snippets.

@ColinScott
Created July 6, 2015 05:11
Show Gist options
  • Save ColinScott/3e6668b4607403c9b8d0 to your computer and use it in GitHub Desktop.
Save ColinScott/3e6668b4607403c9b8d0 to your computer and use it in GitHub Desktop.
Fix SQL mangling when encoded in stupid format
var filename = @"<file path>";
var bytes = File.ReadAllBytes(filename);
var newBytes = new List<byte>();
for (var i = 0; i < bytes.Length; i++)
{
if (bytes[i] == 0x0D && bytes[i+1] == 0x0A)
{
i++;
}
newBytes.Add(bytes[i]);
}
File.WriteAllBytes(filename, newBytes.ToArray());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment