[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [fallback-scripts/master] lookup: py3: Decode ContactInfos to UTF-8
commit 2b389039f8e236ec125ffa0d400bd362e4dca61f
Author: teor <teor@xxxxxxxxxxxxxx>
Date: Mon Dec 2 15:36:56 2019 +1000
lookup: py3: Decode ContactInfos to UTF-8
But do replacements for decoding errors.
Part of 28863.
---
lookupFallbackDirContact.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lookupFallbackDirContact.py b/lookupFallbackDirContact.py
index db17bd7..07aeae7 100755
--- a/lookupFallbackDirContact.py
+++ b/lookupFallbackDirContact.py
@@ -21,7 +21,11 @@ descriptor_list_fingerprints = []
for d in descriptor_list:
assert d.fingerprint in sys.argv[1:]
descriptor_list_fingerprints.append(d.fingerprint)
- contact = d.contact if d.contact else "(no contact)"
+ if d.contact:
+ # Most ContactInfos should be UTF-8
+ contact = d.contact.decode(encoding="utf-8", errors="replace")
+ else:
+ contact = "(no contact)"
print("{} {}".format(d.fingerprint, contact))
for fingerprint in sys.argv[1:]:
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits