From 4d9ba75b721b5ccf9e791098ee19fa74e24b03b4 Mon Sep 17 00:00:00 2001 From: deathfantasy Date: Fri, 2 Oct 2015 02:28:47 +0700 Subject: [PATCH] send properly encoded username/hostname string --- pupy/pupylib/PupyServer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pupy/pupylib/PupyServer.py b/pupy/pupylib/PupyServer.py index e7531b17..4ea14137 100644 --- a/pupy/pupylib/PupyServer.py +++ b/pupy/pupylib/PupyServer.py @@ -63,6 +63,8 @@ class PupyServer(threading.Thread): import uuid import sys import os + import locale + os_encoding = locale.getpreferredencoding() or "utf8" def get_uuid(): user=None node=None @@ -75,11 +77,11 @@ class PupyServer(threading.Thread): proc_arch=None proc_path=sys.executable try: - user=getpass.getuser() + user=getpass.getuser().decode(encoding=os_encoding).encode("utf8") except Exception: pass try: - node=platform.node() + node=platform.node().decode(encoding=os_encoding).encode("utf8") except Exception: pass try: