Mercurial > hg > crecord
changeset 45:946b2961c490
crecord: small improvements of code related to encoding
author | Mark Edgington <edgimar@gmail.com> |
---|---|
date | Mon, 08 Jun 2009 18:49:46 +0200 |
parents | 88dcdf9fc50c |
children | 7f54a33a69d3 |
files | crecord/chunk_selector.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/crecord/chunk_selector.py +++ b/crecord/chunk_selector.py @@ -7,7 +7,7 @@ demandimport.ignore.append('mercurial.encoding') try: import mercurial.encoding as encoding -except: +except ImportError: encoding = util @@ -35,6 +35,7 @@ # deal with unicode correctly locale.setlocale(locale.LC_ALL, '') +code = locale.getpreferredencoding() def chunkselector(opts, headerList): """ @@ -381,7 +382,7 @@ width = self.xScreenSize # turn tabs into spaces inStr = inStr.expandtabs(4) - strLen = len(unicode(encoding.fromlocal(inStr), 'utf-8')) + strLen = len(unicode(encoding.fromlocal(inStr), code)) numSpaces = (width - ((strLen + xStart) % width) - 1) return inStr + " " * numSpaces + "\n"