Show More
@@ -657,7 +657,7 b' def toutf8b(s):' | |||||
657 | pass |
|
657 | pass | |
658 |
|
658 | |||
659 | s = pycompat.bytestr(s) |
|
659 | s = pycompat.bytestr(s) | |
660 |
r = b |
|
660 | r = bytearray() | |
661 | pos = 0 |
|
661 | pos = 0 | |
662 | l = len(s) |
|
662 | l = len(s) | |
663 | while pos < l: |
|
663 | while pos < l: | |
@@ -673,7 +673,7 b' def toutf8b(s):' | |||||
673 | c = unichr(0xDC00 + ord(s[pos])).encode('utf-8', _utf8strict) |
|
673 | c = unichr(0xDC00 + ord(s[pos])).encode('utf-8', _utf8strict) | |
674 | pos += 1 |
|
674 | pos += 1 | |
675 | r += c |
|
675 | r += c | |
676 | return r |
|
676 | return bytes(r) | |
677 |
|
677 | |||
678 |
|
678 | |||
679 | def fromutf8b(s): |
|
679 | def fromutf8b(s): | |
@@ -712,7 +712,7 b' def fromutf8b(s):' | |||||
712 | # helper again to walk the string without "decoding" it. |
|
712 | # helper again to walk the string without "decoding" it. | |
713 |
|
713 | |||
714 | s = pycompat.bytestr(s) |
|
714 | s = pycompat.bytestr(s) | |
715 |
r = b |
|
715 | r = bytearray() | |
716 | pos = 0 |
|
716 | pos = 0 | |
717 | l = len(s) |
|
717 | l = len(s) | |
718 | while pos < l: |
|
718 | while pos < l: | |
@@ -722,4 +722,4 b' def fromutf8b(s):' | |||||
722 | if b"\xed\xb0\x80" <= c <= b"\xed\xb3\xbf": |
|
722 | if b"\xed\xb0\x80" <= c <= b"\xed\xb3\xbf": | |
723 | c = pycompat.bytechr(ord(c.decode("utf-8", _utf8strict)) & 0xFF) |
|
723 | c = pycompat.bytechr(ord(c.decode("utf-8", _utf8strict)) & 0xFF) | |
724 | r += c |
|
724 | r += c | |
725 | return r |
|
725 | return bytes(r) |
General Comments 0
You need to be logged in to leave comments.
Login now