The code:
public static string UTF8ToUnicode(this string input)
{
return Encoding.Unicode.GetString(
Encoding.Convert(Encoding.UTF8,
Encoding.Unicode,
Encoding.UTF8.GetBytes(
input)));
}
Example:
string txt ="Hello, World!";
txt.UTF8ToUnicode();
I am not sure this works well. You should enhance your example with more exotic cahracters like é页말...
ReplyDeleteExcellent, Thank you so much. It helped me a lot
ReplyDelete