-1

I have this string below that needs to be convered to ASCII.

I tried to see if it was already ASCII and it seems to be this encoding below. Is there a way to do this in .NET?

The strings first character is symbol: , code point: 1d5dc, position: 1, so non ASCII, but Unicode Character 'MATHEMATICAL SANS-SERIF BOLD CAPITAL I' (U+1D5DC)
Mike Flynn
  • 21,905
  • 50
  • 167
  • 308
  • You've already asked the [similar question](https://stackoverflow.com/questions/64390182/encoding-getencodingcyrillic-making-all-text-question-marks-in-net) – Pavel Anikhouski Oct 16 '20 at 14:16
  • No its different, and if I get a good answer here I can answer the one from the other if people are having issue. I would of never guessed it was an encoding issue in the other question. – Mike Flynn Oct 16 '20 at 14:17
  • The strings in C# are unicode, you can try to convert string character by character [as bytes](https://stackoverflow.com/a/5348852/1997232), but the proper way is to [use Encoding](https://stackoverflow.com/a/400777/1997232). – Sinatr Oct 16 '20 at 14:23

1 Answers1

0

Apply .NET String.Normalize Method using Compatibility Decomposition, see Unicode normalization forms.

If your string is in variable s2 then use something like (an example from the former link):

s2.IsNormalized(NormalizationForm.FormKD)

Here's PowerShell equivalent:

'      '.Normalize('FormKD')
INDOOR SOFTBALL TOURNAMENT DIAMOND JAXX AND HITZ
JosefZ
  • 22,747
  • 4
  • 38
  • 62