Win32com and Unicode

Tim Roberts timr at probo.com
Sat Jan 5 20:52:04 EST 2002


I apologize if this appears twice.  As I was writing it the first time, I
spilled nearly a liter of iced tea into my laptop.  After a quarter century
of computing, you'd think I would know better.  Fortunately, disaster seems
to have been averted, but you can bet I now have a COMPLETE backup...

I have a Postgres database on a Linux machine.  I'm accessing it from
Python 2.2 on Windows via the ADODB interfaces.  Overall, this works very
well.  However, I have one issue I can't resolve.

One of the fields in one of my tables is a last name.  One of the last
names has an accented character (e with acute accent).  When I attempt to
read the contents of that field, I get an exception from the __str__
handler in the Field class generated by the Pythonwin COM Makepy utility:
it complains  that the conversion from Unicode failed because one of the
characters was greater than 127.

I can believe this, but I don't know how to fix it.  In Windows parlance,
is there a way I can register a "code page" with Python so it knows how to
convert characters beyond the lower 128?
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list