Convert Accented Characters to ASCII

It is pretty simple in .NET to convert Western Unicode (non-ASCII, accented, diacritics) to ASCII, but regardless I had a hard time figuring it out it so I’m posting here for my own future reference.

[code lang=”vb”]
Dim strTest as String = "Any string containing accented characters, e.g. åäöéèêÅÄÖÉÈÊ"
strTest = System.Text.Encoding.ASCII.GetString(System.Text.Encoding.GetEncoding(1251).GetBytes(strTest))
[/code]

Published
Categorized as VB.NET

3 comments

Leave a Reply to Pooja Aggarwal Cancel reply

Your email address will not be published. Required fields are marked *