New submission from Christian Clauss <[email protected]>:
BUGS: certain diacritical marks can and should be capitalized...
str.upper() does not .replace('à', 'À').replace('ä', 'Ä').replace('è',
'È').replace('é', 'É').replace('ö', 'Ö').replace('ü', 'Ü'), etc.
str.lower() does not .replace('À', 'à').replace('Ä', 'ä').replace('È',
'è').replace('É', 'é').replace('Ö', 'ö').replace('Ü', 'ü'), etc.
str.title() has the same problems plus it capitalizes the letter _after_ a
diacritic. e.g. 'lüsai'.title() --> 'LÜSai' with a capitol 'S'
myUpper(), myLower(), myTitle() exhibit the correct behavior with a handful
of diacritic marks.
def myUpper(inString):
return inString.upper().replace('à', 'À').replace('ä', 'Ä').replace('è',
'È').replace('é', 'É').replace('ö', 'Ö').replace('ü', 'Ü')
def myLower(inString):
return inString.lower().replace('À', 'à').replace('Ä', 'ä').replace('È',
'è').replace('É', 'é').replace('Ö', 'ö').replace('Ü', 'ü')
def myTitle(inString): # WARNING: converts all whitespace to a single space
returnValue = []
for theWord in inString.split():
returnValue.append(myUpper(theWord[:1]) + myLower(theWord[1:]))
return ' '.join(returnValue)
----------
components: Unicode
messages: 158332
nosy: Christian.Clauss, ezio.melotti
priority: normal
severity: normal
status: open
title: Certain diacritical marks can and should be capitalized... e.g. ü --> Ü
versions: Python 2.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14587>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com