(val)
| 109 | |
| 110 | # Helper to decode utf8 encoded str to unicode type in Python 2. NOOP in Python 3. |
| 111 | def utf8_decode_if_needed(val): |
| 112 | if sys.version_info.major < 3 and isinstance(val, str): |
| 113 | val = val.decode('utf-8', errors='replace') |
| 114 | return val |
| 115 | |
| 116 | |
| 117 | # Helper to decode unicode to utf8 encoded str in Python 2. NOOP in Python 3. |
no test coverage detected