International characters and Python's string functions on Linux

Alexander Staubo earlybird at
Sat Aug 7 04:28:35 CEST 1999

In article <Pine.LNX.4.04.9908061223110.24989-
100000 at>, phd at says...
> On Thu, 5 Aug 1999, John (Max) Skaller wrote:
> > 	Wrong. Python doesn't use C locale functions.
>    What about
> import locale
> locale.setlocale(locale.LC_ALL, "")
>    ? With this, python supports locale without any problem.

Good idea, but:

Python 1.5.2 (#9, Jul  2 1999, 04:33:02)  [GCC 2.8.1] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import locale
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python1.5/", line 4, in ?
    from _locale import *
ImportError: No module named _locale

This is Slackware Linux 2.2/libc6. Should I configure Python with some 
kind of magic parameter for the locale stuff to work?
> > UTF-8 is,
> > in my opinion, the best option in Python today, since it
>    I don't think so. UNICODE/UTF8 have not only advatntages, but some
> drawbacks too...

In general, UNICODE is great -- at least if we ignore the fact that it 
doubles memory consumption, and in 99% of all cases with no particular 
benefit to the application or the user.

But in the context of Zope, which is where I need the international 
support right now, it's useless -- I doubt Zope can be easily tweaked to 
use UNICODE what with all the string stuff in C assuming 8-bit character 

Anyway, Latin 1 is perfectly capable of containing the characters I need, 
so all this is academic -- I just need to expand the range of the 
uppercase/lowercase constants, cleanly. The documentation warns against 
modifying these directly. Unless somebody tells me this is safe, I want 
to avoid it.

Alexander Staubo   
"Elvis skipped around the car and threw open the trunk.
'Hoopla!' he was heard to say, 'This is a 7.62mm M134 General
Electric Minigun. Up to 6,000 rounds per minute. 7.62mm X 51 shells.
1.36kg recoil adaptors. Six muzzle velocity of 869m/s.'
'Oh,' said Rex, 'So that's what it is.'"
--Robert Rankin, _They Came And Ate Us: Armageddon 2: The B-Movie_

More information about the Python-list mailing list