1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
From: Yaroslav Halchenko <debian@onerussian.com>
Date: Tue, 9 Jun 2009 13:55:40 -0400
Subject: [PATCH] BF: using patch from http://www.freebsd.org/cgi/query-pr.cgi?pr=125327. (Closes: #504812)
---
gcalcli | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
--- a/gcalcli
+++ b/gcalcli
@@ -214,29 +214,35 @@ class CLR_BRCYN(CLR): color = "\033[36;1
class CLR_WHT(CLR): color = "\033[0;37m"
class CLR_BRWHT(CLR): color = "\033[37;1m"
+def cunicode(s):
+ """Conditional conversion to unicode if string is not yet unicode
+ """
+ if not isinstance(s, unicode):
+ return unicode(s, 'UTF-8')
+ return s
def PrintErrMsg(msg):
if CLR.useColor:
sys.stdout.write(str(CLR_BRRED()))
- sys.stdout.write(msg)
+ sys.stdout.write(cunicode(msg))
sys.stdout.write(str(CLR_NRM()))
else:
- sys.stdout.write(msg)
+ sys.stdout.write(unicode(msg, 'UTF-8'))
def PrintMsg(color, msg):
if CLR.useColor:
sys.stdout.write(str(color))
- sys.stdout.write(msg)
+ sys.stdout.write(cunicode(msg))
sys.stdout.write(str(CLR_NRM()))
else:
- sys.stdout.write(msg)
+ sys.stdout.write(unicode(msg, 'UTF-8'))
def DebugPrint(msg):
return
sys.stdout.write(str(CLR_YLW()))
- sys.stdout.write(msg)
+ sys.stdout.write(cunicode(msg))
sys.stdout.write(str(CLR_NRM()))
|