How to convert ’ to apostrophe in C#?
c#
Solution
Try the following:
var bytes = Encoding.Default.GetBytes("’");
var text = Encoding.UTF8.GetString(bytes);
Console.WriteLine(text);
Problem
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