Whenever I try to convert '™' to hex string using
string.Format("{0:X}", (int)"™");
It returns 2122 which is weird because when I use online converters I get 99. Why?
99 is the code for ™ in the Windows-1252 encoding, while 2122 is the code according to the Unicode standard.
As explained by Cito, 99 is the code for ™ in the Windows-1252 encoding. You can get it as follows:
var result = Encoding.GetEncoding("Windows-1252")
.GetBytes("™")
.Single()
.ToString("X");
// result == "99"
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