Decode `content` using the given `encoding`. If no `encoding` is provided, the best effort is to guess it from `content`. Unicode errors are replaced.
(content: ContentBytes, encoding: str)
| 30 | |
| 31 | |
| 32 | def smart_decode(content: ContentBytes, encoding: str) -> Tuple[str, str]: |
| 33 | """Decode `content` using the given `encoding`. |
| 34 | If no `encoding` is provided, the best effort is to guess it from `content`. |
| 35 | |
| 36 | Unicode errors are replaced. |
| 37 | |
| 38 | """ |
| 39 | if not encoding: |
| 40 | encoding = detect_encoding(content) |
| 41 | return content.decode(encoding, 'replace'), encoding |
| 42 | |
| 43 | |
| 44 | def smart_encode(content: str, encoding: str) -> bytes: |
no test coverage detected