From: khamidou Date: Fri, 12 Feb 2010 08:13:40 +0000 (+0100) Subject: fixed weird unicode piping bug X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=7f6cc73ff2a4721e8bdd37eef811a8ca68ad8124;p=liszt.git fixed weird unicode piping bug --- diff --git a/liszt b/liszt index b7d1212..a609d5e 100755 --- a/liszt +++ b/liszt @@ -1,4 +1,5 @@ #!/usr/bin/env python +#coding=utf8 from __future__ import with_statement # @@ -14,13 +15,14 @@ import fnmatch import tempfile import datetime import locale +import codecs try: import json except ImportError: import simplejson as json -locale.setlocale(locale.LC_ALL, locale=locale.getdefaultlocale()) +sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout) def help(): print "liszt c|create listname ?entryname? " @@ -164,7 +166,7 @@ class CommandParser(object): except IndexError: bailout("Invalid entry index.") - print entry["title"].decode("utf8") + "\t" + entry["date"] + print entry["title"] + "\t" + entry["date"] def parse_remove(self, args): if len(args) == 0 or len(args) > 2: