Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/encoding.py @ 10282:08a0f04b56bd
many, many trivial check-code fixups
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 25 Jan 2010 00:05:27 -0600 |
parents | 25e572394f5c |
children | d320e70442a5 |
comparison
equal
deleted
inserted
replaced
10281:e7d3b509af8b | 10282:08a0f04b56bd |
---|---|
60 Unicode character, and 'ignore', which drops the character. | 60 Unicode character, and 'ignore', which drops the character. |
61 """ | 61 """ |
62 try: | 62 try: |
63 return s.decode(encoding, encodingmode).encode("utf-8") | 63 return s.decode(encoding, encodingmode).encode("utf-8") |
64 except UnicodeDecodeError, inst: | 64 except UnicodeDecodeError, inst: |
65 sub = s[max(0, inst.start-10):inst.start+10] | 65 sub = s[max(0, inst.start - 10):inst.start + 10] |
66 raise error.Abort("decoding near '%s': %s!" % (sub, inst)) | 66 raise error.Abort("decoding near '%s': %s!" % (sub, inst)) |
67 except LookupError, k: | 67 except LookupError, k: |
68 raise error.Abort("%s, please check your locale settings" % k) | 68 raise error.Abort("%s, please check your locale settings" % k) |
69 | 69 |
70 def colwidth(s): | 70 def colwidth(s): |