unicode confusion

Brian Quinlan brian at sweetapp.com
Mon Feb 10 11:51:11 EST 2003


> I have still problems handling pythonstrings with unicode. Reading and
> writing files with the codecs module is no problem, but now I have a
new
> problem: Using win32com I get a unicode string from a COM object. As
far
> as I understand, the string should be ucs16 if it comes from COM. But
is
> there a way to check this? Is there at all a way to get the encoding
of a
> string, or at least to guess?

Conceptually, a Python unicode object has no encoding so don't worry
about that.

> data.encode('utf-8') does not raises an error but the returned text is
> broken.

How so? What unicode object did you start with and what did
encode('utf-8') return?

Cheers,
Brian






More information about the Python-list mailing list