Let's say I have a random Chinese character, 玩. I want to convert it to Unicode, which would be U+73A9. How could I do this in C#?
Take myChar as a char referencing your special character...
Console.WriteLine("{0} U+{1:x4} {2}", myChar, (int)myChar, (int)myChar);
Above we're outputting the character itself followed by the Unicode code point and then the integer value.
Reduce the format string and parameters to output only the "U+..." code...
Console.WriteLine("U+{0:x4}", (int)myChar);
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