def safeConvert(self, chunk):
        # Exceptionally gross, but the safest way
        # I've found to ensure I get a legit unicode object
        if not chunk:
            return u''
        if isinstance(chunk, unicode):
            return chunk
        try:
            return chunk.decode('utf-8', 'strict')
        except UnicodeDecodeError:
            try:
                return chunk.decode('latin-1', 'strict')
            except UnicodeDecodeError:
                return chunk.decode('ascii', 'ignore')
        except __HOLE__:
            return unicode(chunk, errors='ignore')
        return chunk
dataset/ETHPy150Open binhex/moviegrabber/lib/site-packages/Cheetah/DummyTransaction.py/DummyResponse.safeConvert