Created
February 26, 2015 18:04
-
-
Save yosemitebandit/4e9609e22122362e2524 to your computer and use it in GitHub Desktop.
decode and resave urlencoded files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import urllib | |
# Read. | |
with open(sys.argv[1]) as cdr_file: | |
cdr_data = cdr_file.read() | |
# Decode. | |
decoded_data = urllib.unquote(cdr_data).decode('utf8') | |
print decoded_data | |
# Write. | |
new_filename = '%s.decoded' % sys.argv[1] | |
with open(new_filename, 'w') as decoded_file: | |
decoded_file.write(decoded_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment