HighTechTalks DotNet Forums  

Removing diacritics

Dotnet Internationalization microsoft.public.dotnet.internationalization


Discuss Removing diacritics in the Dotnet Internationalization forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jan Kucera
 
Posts: n/a

Default Removing diacritics - 09-13-2007 , 07:29 AM






Hi,
is there any other way to remove diacritics in .NET, than

StringBuilder normalized = new
StringBuilder("aáùø".Normalize(NormalizationForm.F ormD));
for (int i = 0; i < normalized.Length; i++)
if (char.GetUnicodeCategory(normalized[i]) ==
UnicodeCategory.NonSpacingMark)
{
normalized.Remove(i, 1);
i--;
}

?

Jan


Reply With Quote
  #2  
Old   
Michael S. Kaplan [MSFT]
 
Posts: n/a

Default Re: Removing diacritics - 09-14-2007 , 03:09 AM






Well, get the improved code from here:

http://blogs.msdn.com/michkap/archiv...19/376617.aspx

and note that I point out the semantic flaw here:

http://blogs.msdn.com/michkap/archiv...4/4734456.aspx

After I finish the current series on sort keys I'll be posting some solution
ideas to the problem raised there.

There is no other way in the framework though, sorry.


--

MichKa [Microsoft]
Fundamentals Technical Lead
Windows International
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.


"Jan Kucera" <miloush (AT) community (DOT) nospam> wrote

Quote:
Hi,
is there any other way to remove diacritics in .NET, than

StringBuilder normalized = new
StringBuilder("aáùø".Normalize(NormalizationForm.F ormD));
for (int i = 0; i < normalized.Length; i++)
if (char.GetUnicodeCategory(normalized[i]) ==
UnicodeCategory.NonSpacingMark)
{
normalized.Remove(i, 1);
i--;
}

?

Jan



Reply With Quote
  #3  
Old   
Jan Kucera
 
Posts: n/a

Default Re: Removing diacritics - 09-14-2007 , 04:09 AM



Hmm... I should begin to count with that every question I ask, you have
already answered. That way I maybe won't feel so reckless. :-)
And thanks, not only for your patience.

Pity there is no "ignore diacritics" flag in RegularExpression settings.

Looking forward to your post, and enjoying the sort keys series!
Jan



"Michael S. Kaplan [MSFT]" <michka (AT) online (DOT) microsoft.com> wrote

Quote:
Well, get the improved code from here:

http://blogs.msdn.com/michkap/archiv...19/376617.aspx

and note that I point out the semantic flaw here:

http://blogs.msdn.com/michkap/archiv...4/4734456.aspx

After I finish the current series on sort keys I'll be posting some
solution ideas to the problem raised there.

There is no other way in the framework though, sorry.


--

MichKa [Microsoft]
Fundamentals Technical Lead
Windows International
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.


"Jan Kucera" <miloush (AT) community (DOT) nospam> wrote in message
news:610794DE-F136-4AC6-8899-72C89BD153E3 (AT) microsoft (DOT) com...
Hi,
is there any other way to remove diacritics in .NET, than

StringBuilder normalized = new
StringBuilder("aáùø".Normalize(NormalizationForm.F ormD));
for (int i = 0; i < normalized.Length; i++)
if (char.GetUnicodeCategory(normalized[i]) ==
UnicodeCategory.NonSpacingMark)
{
normalized.Remove(i, 1);
i--;
}

?

Jan



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.