From: Oleg Broytman Date: Thu, 14 Jun 2007 13:22:31 +0000 (+0000) Subject: Convert the filename to unicode (to split by characters, not bytes). X-Git-Tag: v4.0.0~49 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=7bd60ece21bad56c75f899e33683a391bb42143d;p=xsetbg.git Convert the filename to unicode (to split by characters, not bytes). git-svn-id: file:///home/phd/archive/SVN/xsetbg/trunk@19 143022c7-580b-0410-bae3-87f2bf5d3141 --- diff --git a/print-filename.py b/print-filename.py index 7a5f754..c0d3c8e 100755 --- a/print-filename.py +++ b/print-filename.py @@ -12,7 +12,7 @@ __revision__ = "$Id$"[5:-2] __date__ = "$Date$"[7:-2] __author__ = "Oleg BroytMann " -__copyright__ = "Copyright (C) 2004-2006 PhiloSoft Design" +__copyright__ = "Copyright (C) 2004-2007 PhiloSoft Design" __license__ = "GNU GPL" @@ -81,18 +81,19 @@ else: filename = global_db[key] global_db.close() +from m_lib.defenc import default_encoding +filename = unicode(filename, default_encoding) if width: lines = [] while filename: lines.append("%s%s%s" % (spaces, filename[:width], spaces)) filename = filename[width:] - filename = "\n".join(lines) + filename = u'\n'.join(lines) else: - filename = "%s%s%s" % (spaces, filename, spaces) + filename = u"%s%s%s" % (spaces, filename, spaces) - -sys.stdout.write(filename) +sys.stdout.write(filename.encode(default_encoding)) if print0: sys.stdout.write('\0')