encoding: handle non-BMP characters in fromutf8b

This commit is contained in:
Matt Mackall 2015-11-05 17:11:50 -06:00
parent 001845ef91
commit cc7a93dfa3

View File

@ -504,7 +504,7 @@ def fromutf8b(s):
u = s.decode("utf-8")
r = ""
for c in u:
if ord(c) & 0xff00 == 0xdc00:
if ord(c) & 0xffff00 == 0xdc00:
r += chr(ord(c) & 0xff)
else:
r += c.encode("utf-8")