| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c7392d6 commit c5f3c58
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -118,10 +118,8 @@ def b(data): | |||
| 118 | 118 | return data | |
| 119 | 119 | ||
| 120 | 120 | if PY3: | |
| 121 | - _unichr = chr | ||
| 122 | 121 | bytes_chr = lambda code: bytes((code,)) | |
| 123 | 122 | else: | |
| 124 | - _unichr = unichr | ||
| 125 | 123 | bytes_chr = chr | |
| 126 | 124 | ||
| 127 | 125 | def surrogateescape_handler(exc): | |
@@ -176,9 +174,9 @@ def replace_surrogate_encode(mystring, exc): | |||
| 176 | 174 | # 0x80 | (code & 0x3f)] | |
| 177 | 175 | # Is this a good idea? | |
| 178 | 176 | if 0xDC00 <= code <= 0xDC7F: | |
| 179 | - decoded.append(_unichr(code - 0xDC00)) | ||
| 177 | + decoded.append(chr(code - 0xDC00)) | ||
| 180 | 178 | elif code <= 0xDCFF: | |
| 181 | - decoded.append(_unichr(code - 0xDC00)) | ||
| 179 | + decoded.append(chr(code - 0xDC00)) | ||
| 182 | 180 | else: | |
| 183 | 181 | raise NotASurrogateError | |
| 184 | 182 | return str().join(decoded) | |
@@ -197,9 +195,9 @@ def replace_surrogate_decode(mybytes): | |||
| 197 | 195 | else: | |
| 198 | 196 | code = ord(ch) | |
| 199 | 197 | if 0x80 <= code <= 0xFF: | |
| 200 | - decoded.append(_unichr(0xDC00 + code)) | ||
| 198 | + decoded.append(chr(0xDC00 + code)) | ||
| 201 | 199 | elif code <= 0x7F: | |
| 202 | - decoded.append(_unichr(code)) | ||
| 200 | + decoded.append(chr(code)) | ||
| 203 | 201 | else: | |
| 204 | 202 | # # It may be a bad byte | |
| 205 | 203 | # # Try swallowing it. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments