Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

converting unicode to actual character C# [duplicate]

I have a string "Some string that I am using but Poacher\u2019s shows unicode!" I'm trying to have the Unicode convert into the ' character.

like image 733
William McCarty Avatar asked Sep 01 '25 01:09

William McCarty


1 Answers

Something like that should work :

string text = "Some string that I am using but Poacher\u2019s shows unicode!";
byte[] textBytes = Encoding.Unicode.GetBytes(text);
Encoding.UTF8.GetString(Encoding.Convert(Encoding.Unicode, Encoding.UTF8, textBytes));

Please see the Encoding class on MSDN.

like image 193
Fabien ESCOFFIER Avatar answered Sep 02 '25 14:09

Fabien ESCOFFIER