Fixed #442: improved grouping in AllPages.aspx. Accented letters are now normalized and grouped with non-accented letters. Patch provided by 'styx31'.

This commit is contained in:
Dario Solera 2010-01-03 09:58:33 +00:00
parent 4769cc7157
commit a86faf35cc
2 changed files with 17 additions and 3 deletions

View file

@ -73,7 +73,21 @@ namespace ScrewTurn.Wiki {
}
private static char GetFirstChar(string value) {
return value.ToUpper(CultureInfo.CurrentCulture)[0];
if(string.IsNullOrEmpty(value)) return '0';
// First we normalize the value to separate diacritics
string normalized = value.ToUpper(CultureInfo.CurrentCulture).Normalize(System.Text.NormalizationForm.FormD);
int count = normalized.Length;
for(int i = 0; i < count; i++) {
char c = normalized[i];
if(CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark) {
// We return the first non-spacing mark
return c;
}
}
return '0';
}
/// <summary>