Message158332
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) |
|
Date |
User |
Action |
Args |
2012-04-15 14:17:28 | Christian.Clauss | set | recipients:
+ Christian.Clauss, ezio.melotti |
2012-04-15 14:17:28 | Christian.Clauss | set | messageid: <1334499448.33.0.168656695712.issue14587@psf.upfronthosting.co.za> |
2012-04-15 14:17:27 | Christian.Clauss | link | issue14587 messages |
2012-04-15 14:17:27 | Christian.Clauss | create | |
|