summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-11-13 14:35:49 +0100
committerErich Eckner <git@eckner.net>2021-11-13 14:35:49 +0100
commit86cf98a8a179e0751124c9a14c307c41b1e57422 (patch)
tree425cb8c88d4fd1dacbd7e3dfbde2af29c6faaea7
parente1d54ce8fbafddac23c555afc7dea6c659633bd4 (diff)
downloadsammleEmails-master.tar.xz
add basic decodingHEADmaster
-rwxr-xr-xcollect-tos-for-alpine-addressbook30
1 files changed, 29 insertions, 1 deletions
diff --git a/collect-tos-for-alpine-addressbook b/collect-tos-for-alpine-addressbook
index aed5522..a2766ca 100755
--- a/collect-tos-for-alpine-addressbook
+++ b/collect-tos-for-alpine-addressbook
@@ -1,5 +1,32 @@
#!/bin/bash
+decode() {
+ sed '
+ :a
+ s/=?\(ISO-8859-15\?\|windows-1252\|UTF-8\)?Q?\([^=_]*\)?=/\2/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)_/\1 /
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=E4/\1ä/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=E9/\1é/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=F6/\1ö/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=F8/\1ř/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=FC/\1ü/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=FD/\1ý/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=DF/\1ß/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=22/\1"/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=2C/\1,/
+ s/\(=?\(ISO-8859-15\?\|windows-1252\)?Q?[^=]*\)=2E/\1,/
+ s/\(=?UTF-8?Q?[^=]*\)_/\1 /
+ s/\(=?UTF-8?Q?[^=]*\)=c3=a4/\1ä/
+ s/\(=?UTF-8?Q?[^=]*\)=c3=b6/\1ö/
+ s/\(=?UTF-8?Q?[^=]*\)=c3=bc/\1ü/
+ s/\(=?UTF-8?Q?[^=]*\)=c3=9f/\1ß/
+ s/\(=?UTF-8?Q?[^=]*\)=c3=98/\1ø/
+ s/\(=?UTF-8?Q?[^=]*\)=22/\1"/
+ s/\(=?UTF-8?Q?[^=]*\)=2c/\1,/
+ ta
+ '
+}
+
sed '
:a
N
@@ -35,7 +62,8 @@ done \
"$(
printf '%s\n' "${comment}" \
| base64 -d \
- | sed 's@^\(["'"'"']\)\(.*\)\1@\2@'
+ | sed 's@^\(["'"'"']\)\(.*\)\1@\2@' \
+ | decode
)" \
"${email}"
done