(x, charset="utf-8", errors="strict")
| 16 | |
| 17 | |
| 18 | def to_unicode(x, charset="utf-8", errors="strict"): |
| 19 | if x is None or isinstance(x, str): |
| 20 | return x |
| 21 | if isinstance(x, bytes): |
| 22 | return x.decode(charset, errors) |
| 23 | return str(x) |
| 24 | |
| 25 | |
| 26 | def to_native(x, encoding="ascii"): |
searching dependent graphs…