mercurial/encoding.py
changeset 10282 08a0f04b56bd
parent 10263 25e572394f5c
child 11297 d320e70442a5
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):