]>
Commit | Line | Data |
---|---|---|
d2e6a577 FG |
1 | |
2 | def as_string(string): | |
3 | """ | |
4 | Ensure that whatever type of string is incoming, it is returned as an | |
5 | actual string, versus 'bytes' which Python 3 likes to use. | |
6 | """ | |
7 | if isinstance(string, bytes): | |
8 | # we really ignore here if we can't properly decode with utf-8 | |
9 | return string.decode('utf-8', 'ignore') | |
10 | return string |