Try to properly handle utf-8 and latin-1 encoded client names in the peers tab.
This commit is contained in:
parent
7219c84c78
commit
4f23af98da
|
@ -1022,9 +1022,16 @@ class DelugeGTK:
|
||||||
izip(peer["ip"].split("."),
|
izip(peer["ip"].split("."),
|
||||||
(24, 16, 8, 0))])
|
(24, 16, 8, 0))])
|
||||||
|
|
||||||
|
client = peer["client"]
|
||||||
|
try:
|
||||||
|
client = client.decode('utf-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
# Fallback to latin-1 in case peer's client
|
||||||
|
# doesn't use utf-8. utorrent < 1.7 for example
|
||||||
|
client = client.decode('latin-1')
|
||||||
|
|
||||||
iter = self.peer_store.append([ip_int, peer["ip"],
|
iter = self.peer_store.append([ip_int, peer["ip"],
|
||||||
unicode(peer["client"], "latin-1"),
|
client, round(peer["peer_has"], 2),
|
||||||
round(peer["peer_has"], 2),
|
|
||||||
peer["download_speed"],
|
peer["download_speed"],
|
||||||
peer["upload_speed"]])
|
peer["upload_speed"]])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue