Print formatted Strings with Umlauts

Joerg Lehmann joerg.lehmann at
Thu Feb 12 19:42:12 CET 2004

"Martin v. Löwis" <martin at> wrote in message news:<c0f8tb$5iu$05$1 at>...
> Joerg Lehmann wrote:
> > I am using Python 2.2.3 (Fedora Core 1). ...
> > I have tried to set the encoding in to 'latin-1', but it did not change
> > my results. Is there no way to store umlauts in 1 byte??? 
> There is, but Fedora Core 1 does not use it. Instead, it uses an
> encoding where an umlaut character needs two bytes (namely, UTF-8).
> Changing does not change the way your system represents
> these characters.
> > What is the right way
> > to print strings containing umlauts in a tabular way (same field width)?
> As Jeff explains: In the specific case, using Unicode strings would
> help. He is also right that, in general, it is very difficult to find
> out how many columns a single character uses, as some characters have
> width 0, and other characters have width 2 (in a mono-spaced terminal;
> for variable-spaced output, adding space characters to achieve
> formatting will never work reliably).
> Regards,
> Martin

I have found a fix myself, I'm not sure if this is "the right way",
but it solves my problem:

I changed the settings in /etc/sysconfig/i18ln from UTF-8 to


This fixed my problem, Umlauts are stored in one byte now.

Thanks for your inspirations.

PS: Installing Python 2.3 (rpm for Fedora from did not
Joerg Lehmann

More information about the Python-list mailing list