(string, codec)
| 153 | # Convenience function for encoding strings, taking into account |
| 154 | # that they might be unknown-8bit (ie: have surrogate-escaped bytes) |
| 155 | def _encode(string, codec): |
| 156 | if codec == UNKNOWN8BIT: |
| 157 | return string.encode('ascii', 'surrogateescape') |
| 158 | else: |
| 159 | return string.encode(codec) |
| 160 | |
| 161 | |
| 162 | class Charset: |
no test coverage detected
searching dependent graphs…