Skip to content

Instantly share code, notes, and snippets.

View brendankowitz's full-sized avatar

Brendan Kowitz brendankowitz

View GitHub Profile
@andyraddatz
andyraddatz / ASCIIStringExtensions.cs
Last active May 29, 2024 15:10
C# String extension method to fold diacritics to ASCII characters
// IMPORTANT
using System.Text;
// This gist was created thanks to this comment from Alexander on StackOverflow:
// https://stackoverflow.com/questions/249087/how-do-i-remove-diacritics-accents-from-a-string-in-net#comment86833005_34272324
// This is a derivative work. The logic of this function comes from a switch statement found inside the
// Lucene.Net library. The documentation of the conversion of characters is quite impressive
// (thank you @NightOwl888 and @synhershko !!!):
// https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/ASCIIFoldingFilter.cs