-----BEGIN PGP SIGNED MESSAGE----- Hash SHA1 usr bin python encoding u

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
#!/usr/bin/python
# -*- encoding: utf-8 -*-
from exceptions import UnicodeTranslateError
import sys
unknown = u'\ufffd'
for line in sys.stdin:
if not line.startswith('--'):
latin = line.decode('utf-8').encode('latin1', 'replace').decode('utf-8', 'replace')
cp = line.decode('utf-8').encode('cp1252', 'replace').decode('utf-8', 'replace')
decoded = ""
for foo, bar in zip(latin, cp):
if foo == bar and foo != unknown:
decoded += foo
elif foo == unknown and bar != unknown:
decoded += bar
elif foo != unknown and bar == unknown:
decoded += foo
else:
raise UnicodeTranslateError
line = decoded.encode('utf8')
sys.stdout.write(line)
# vim:set tabstop=4 softtabstop=4 shiftwidth=4:
# vim:set foldmethod=marker foldlevel=32 foldmarker={{{,}}}:
# vim:set expandtab:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAkkAAYQACgkQbNKln9z6vVyVoQCgivnyJiePlOEcoeq7VI9Bz3UZ
nJIAnjY6k4ZI94VWvYQW6ejHHUNjO83O
=fZhr
-----END PGP SIGNATURE-----