Mercurial > public > mercurial-scm > hg
diff mercurial/util.py @ 9508:e2fd9b62349b
Merge with -stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 30 Sep 2009 21:42:51 -0500 |
parents | ca3390c19f88 b2d65ee49a72 |
children | 4368f582c806 |
line wrap: on
line diff
--- a/mercurial/util.py Thu Oct 01 00:00:18 2009 +0200 +++ b/mercurial/util.py Wed Sep 30 21:42:51 2009 -0500 @@ -1280,9 +1280,12 @@ padding = '\n' + ' ' * hangindent # To avoid corrupting multi-byte characters in line, we must wrap # a Unicode string instead of a bytestring. - u = line.decode(encoding.encoding) - w = padding.join(textwrap.wrap(u, width=width - hangindent)) - return w.encode(encoding.encoding) + try: + u = line.decode(encoding.encoding) + w = padding.join(textwrap.wrap(u, width=width - hangindent)) + return w.encode(encoding.encoding) + except UnicodeDecodeError: + return padding.join(textwrap.wrap(line, width=width - hangindent)) def iterlines(iterator): for chunk in iterator: