convert utf-8 to latin-1?

Jarek Zgoda jzgoda at
Thu Feb 5 19:51:41 CET 2004

Uwe Mayer <merkosh at> pisze:

> in a PyQt application I'm writing, the user can select a filename with a
> FileDialog. Then I would like to open this file. This works fine if there
> are no "special symbols" in the filename, such as the german umlauts: "ÖÄÜ"
> Currently I convert the returned, of what I'm pretty sure its a utf-8 string
> object, to a normal string using the str() function. But then my string
> contains garbage and I cannot find that file on my ext3 fs (which uses
> latin-1).
> So my first question is wether you *can* convert it without loosing
> something and secondly: how?

I use unicode() to convert QString returned by Qt widgets to unicode
object, then encode it in latin2. Qt uses its own string class, not
ordinary strings.

Jarek Zgoda
Unregistered Linux User #-1

More information about the Python-list mailing list