I have tried several combinations of ASCII, Latin1, Windows-1252, UTF-8 and Unicode to convert ’ to apostrophe in C#, but to no avail.
byte[] uBytes = Encoding.Unicode.GetBytes(questionString);
byte[] utf8Bytes = Encoding.Convert(Encoding.Unicode, Encoding.UTF8, uBytes);
string converted = Encoding.UTF8.GetString(utf8Bytes);
I am using this conversion chart to discover what each code should be: http://www.i18nqa.com/debug/utf8-debug.html
html - An apostrophe is rendering as â€tm.
Â, â (a-circumflex) is a letter of the Inari Sami, Skolt Sami, Romanian, and Vietnamese alphabets. This letter also appears in French, Friulian, Frisian, Portuguese, Turkish, Walloon, and Welsh languages as a variant of the letter "a". It is included in some romanization systems for Persian, Russian, and Ukrainian.
Most C string library routines still work with UTF-8, since they only scan for terminating NUL characters.
Try the following:
var bytes = Encoding.Default.GetBytes("’");
var text = Encoding.UTF8.GetString(bytes);
Console.WriteLine(text);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With