From 19f3133e92a5f481d4afa9a6babde65477a8c411 Mon Sep 17 00:00:00 2001 From: Bayarkhuu Bataa Date: Tue, 11 Jun 2019 10:15:37 +0800 Subject: [PATCH 1/2] fix unicode decode error. --- zk/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zk/user.py b/zk/user.py index 8c7da46..10a6bfe 100644 --- a/zk/user.py +++ b/zk/user.py @@ -5,7 +5,7 @@ class User(object): def __init__(self, uid, name, privilege, password='', group_id='', user_id='', card=0): self.uid = uid - self.name = str(name) + self.name = u'{0}'.format(name) self.privilege = privilege self.password = str(password) self.group_id = str(group_id) From 8f887a2037deafe0ec49a3ede36a62d1978013d8 Mon Sep 17 00:00:00 2001 From: Bayarkhuu Bataa Date: Wed, 24 Jul 2019 16:10:06 +0800 Subject: [PATCH 2/2] Fix unicode error of device user's non-english name. --- zk/user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zk/user.py b/zk/user.py index 10a6bfe..5598ea2 100644 --- a/zk/user.py +++ b/zk/user.py @@ -34,7 +34,7 @@ class User(object): return pack(": [uid:{}, name:{} user_id:{}]'.format(self.uid, self.name, self.user_id) + return u': [uid:{}, name:{} user_id:{}]'.format(self.uid, self.name, self.user_id) def __repr__(self): - return ': [uid:{}, name:{} user_id:{}]'.format(self.uid, self.name, self.user_id) + return u': [uid:{}, name:{} user_id:{}]'.format(self.uid, self.name, self.user_id)