[New-bugs-announce] [issue1813] Codec lookup failing under turkish locale

Árni Már Jónsson report at bugs.python.org
Sat Jan 12 16:00:13 CET 2008

New submission from Árni Már Jónsson:

When switching to a turkish locale, the codecs registry fails on a codec
lookup which worked before the locale change.

This happens when the codec name contains an uppercase 'I'. What
happens, is just before doing a cache lookup, the string is normalized,
which includes a call to <ctype.h>'s tolower. tolower is locale
dependant, and the turkish locale handles 'I's different from other
locales. Thus, the lookup fails, since the normalization behaves
differently then it did before.

Replacing the tolower() call with this made the lookup work:

int my_tolower(char c)
	if ('A' <= c && c <= 'Z')
		c += 32;

	return c;

PS: If the turkish locale is not supported, this here will enable it to
an Ubuntu system

a) sudo cp /usr/share/i18n/SUPPORTED /var/lib/locales/supported.d/local
   (or just copy the lines with "tr" in them)
b) sudo dpkg-reconfigure locales

components: Interpreter Core
files: verify_locale.py
messages: 59821
nosy: arnimar
severity: normal
status: open
title: Codec lookup failing under turkish locale
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file9140/verify_locale.py

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list