Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import quopri
- import StringIO
- # helpers (the quopri module only supports file-to-file conversion)
- def encodestring(instring, tabs=0):
- outfile = StringIO.StringIO()
- quopri.encode(StringIO.StringIO(instring), outfile, tabs)
- return outfile.getvalue()
- def decodestring(instring):
- outfile = StringIO.StringIO()
- quopri.decode(StringIO.StringIO(instring), outfile)
- return outfile.getvalue()
- firstExample = "=91hey=92"
- print decodestring(firstExample).decode('windows-1252')
- secondExample = "=E2=80=98=E2=80=99,=E2=80=9C=E2=80=9D=3Dhey=C3=B7=C2=BD=C3=96=C3=B1=E2=99=A6=E2=86=92%@=C2=A5=C3=B7"
- print decodestring(secondExample).decode('utf-8')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement