Sorting strings containing special characters (german 'Umlaute')

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Fri Mar 2 15:22:45 EST 2007


Robin Becker wrote:

> 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?

If I'm not mistaken, this would sort all umlauts after the "pure"
vowels. This is, according to <http://de.wikipedia.org/wiki/
Alphabetische_Sortierung>, used in Austria. 

If you can't understand german, the rules given there in
section "Einsortierungsregeln" (roughly: ordering rules) translate
as follows:

"X und Y sind gleich": "X equals Y"
"X kommt nach Y": "X comes after Y"

Regards&HTH,


Björn

-- 
BOFH excuse #146:

Communications satellite used by the military for star wars.




More information about the Python-list mailing list