3void UTF32ToUTF8(dword UTF32Character,
byte *UTF8Character,
byte *BytesPerChar)
8 if(UTF32Character < 0x80)
10 if(UTF8Character) *UTF8Character = UTF32Character;
12 if(BytesPerChar) *BytesPerChar = 1;
19 if(UTF32Character < 0x800)
24 UTF8Character[0] = 0xc0 | ((UTF32Character >> 6) & 0x1f);
25 UTF8Character[1] = 0x80 | (UTF32Character & 0x3f);
28 if(BytesPerChar) *BytesPerChar = 2;
35 if(UTF32Character < 0x10000)
40 UTF8Character[0] = 0xe0 | ((UTF32Character >> 12) & 0x0f);
41 UTF8Character[1] = 0x80 | ((UTF32Character >> 6) & 0x3f);
42 UTF8Character[2] = 0x80 | (UTF32Character & 0x3f);
45 if(BytesPerChar) *BytesPerChar = 3;
54 UTF8Character[0] = 0xf0 | ((UTF32Character >> 18) & 0x07);
55 UTF8Character[1] = 0x80 | ((UTF32Character >> 12) & 0x3f);
56 UTF8Character[1] = 0x80 | ((UTF32Character >> 6) & 0x3f);
57 UTF8Character[2] = 0x80 | (UTF32Character & 0x3f);
60 if(BytesPerChar) *BytesPerChar = 4;
void UTF32ToUTF8(dword UTF32Character, byte *UTF8Character, byte *BytesPerChar)