Skip to content

Instantly share code, notes, and snippets.

@tehmaze
Created August 18, 2015 08:45
Show Gist options
  • Save tehmaze/f8f77292755d5571f007 to your computer and use it in GitHub Desktop.
Save tehmaze/f8f77292755d5571f007 to your computer and use it in GitHub Desktop.
Fix broken ASCIIs interpreted as ANSi by PabloDraw
#!/usr/bin/python
import sys
lines = []
overflow = False
with open(sys.argv[1]) as i:
for line in i:
line = line.rstrip('\r\n')
if overflow:
lines.append(lines.pop(len(lines) - 1) + line)
else:
lines.append(line)
overflow = len(line) >= 80
print '\n'.join(lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment