If this is Unicode code point, you can use the fact that its integer value using the usual integer representation is the same as UTF32-LE representation of the given character. So, you can use this function:
https://msdn.microsoft.com/en-us/library/system.char.convertfromutf32%28v=vs.110%29.aspx.
Interestingly, this is not a character, but a string. This is related to the peculiarities of in-memory representation of strings in .NET: internally, UTF-16 is used, and the characters beyond BMP are represented as
surrogate pairs. Formally, .NET representation deals with the surrogate pair as with two characters (which can lead to forming invalid string if you try to manipulate such string "manually" — never do it), even though, from the Unicode standpoint, this fragment of string represented by 4 bytes is really one character. You need to be careful with such cases, never operate such string on byte basics.
After you got the string (let's call it
someString
, you can use it or represent as UTF-8, which is always some array of bytes:
int codePoint =
string someString = char.ConvertFromUtf32(codePoint);
byte[] utf8 = System.Text.Encoding.UTF8.GetBytes(someString);
Please see:
https://msdn.microsoft.com/en-us/library/system.text.encoding.utf8(v=vs.110).aspx,
https://msdn.microsoft.com/en-us/library/ds4kkd55(v=vs.110).aspx,
https://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.110%29.aspx.
—SA