Lines Matching defs:utf
202 static int codepoint2utf8(unsigned char *out, unsigned long utf)
204 if (utf <= 0x7F) {
206 out[0] = (unsigned char)utf;
209 } else if (utf <= 0x07FF) {
211 out[0] = (unsigned char)(((utf >> 6) & 0x1F) | 0xC0);
212 out[1] = (unsigned char)(((utf >> 0) & 0x3F) | 0x80);
215 } else if (utf <= 0xFFFF) {
217 out[0] = (unsigned char)(((utf >> 12) & 0x0F) | 0xE0);
218 out[1] = (unsigned char)(((utf >> 6) & 0x3F) | 0x80);
219 out[2] = (unsigned char)(((utf >> 0) & 0x3F) | 0x80);
222 } else if (utf <= 0x10FFFF) {
224 out[0] = (unsigned char)(((utf >> 18) & 0x07) | 0xF0);
225 out[1] = (unsigned char)(((utf >> 12) & 0x3F) | 0x80);
226 out[2] = (unsigned char)(((utf >> 6) & 0x3F) | 0x80);
227 out[3] = (unsigned char)(((utf >> 0) & 0x3F) | 0x80);