Sorting strings containing special characters (german 'Umlaute')

Robin Becker robin at reportlab.com
Fri Mar 2 12:49:45 EST 2007


Bjoern Schliessmann wrote:
> Hallvard B Furuseth wrote:
>> DierkErdmann at mail.com writes:
.......
> 
> In German, there are some different forms:
> 
> - the classic sorting for e.g. word lists: umlauts and plain vowels
> are of same value (like you mentioned): ä = a
> 
> - name list sorting for e.g. phone books: umlauts have the same
> value as their substitutes (like Dierk described): ä = ae
> 
> There are others, too, but those are the most widely used.

Björn, in one of our projects we are sorting in javascript in several languages 
English, German, Scandinavian languages, Japanese; from somewhere (I cannot 
actually remember) we got this sort spelling function for scandic languages

a
.replace(/\u00C4/g,'A~') //A umlaut
.replace(/\u00e4/g,'a~') //a umlaut
.replace(/\u00D6/g,'O~') //O umlaut
.replace(/\u00f6/g,'o~') //o umlaut
.replace(/\u00DC/g,'U~') //U umlaut
.replace(/\u00fc/g,'u~') //u umlaut
.replace(/\u00C5/g,'A~~') //A ring
.replace(/\u00e5/g,'a~~'); //a ring

does this actually make sense?
-- 
Robin Becker




More information about the Python-list mailing list