Lines Matching defs:utf8
68 Uint32 Utf8ToUcs4(const Uint8 *utf8)
74 unsigned char firstOctet = utf8[0];
164 /* Now, start filling c.ucs4 with the bits from the continuing octets from utf8. */
167 if ((utf8[i] & 0xC0) /* get the most 2 significant bits by AND'ing with 11000000 */
177 Take only the least 6 significance bits of the current octet (utf8[i]) and fill the created room
179 This done by AND'ing utf8[i] with 00111111 and the OR'ing the result with c.ucs4.
181 c |= utf8[i] & 0x3F;
186 /* Given a UTF-8 encoded string pointed to by utf8 of length length in
234 static int Utf8ToUtf16(const Uint8 *utf8, const int utf8_length, Uint16 *utf16, const int utf16_max_length) {
241 Uint8 const *const end_of_input = utf8 + utf8_length - 1;
243 while (utf8 <= end_of_input) {
244 Uint8 const c = *utf8;
252 utf8 += 1;
258 if (end_of_input - utf8 < 1 || (((utf8[1] ^ 0x80)) & 0xC0)) {
261 *p++ = (Uint16)(0xCF80 + (c << 6) + utf8[1]);
262 utf8 += 2;
265 if (end_of_input - utf8 < 2 || (((utf8[1] ^ 0x80) | (utf8[2] ^ 0x80)) & 0xC0)) {
268 *p++ = (Uint16)(0xDF80 + (c << 12) + (utf8[1] << 6) + utf8[2]);
269 utf8 += 3;
273 if (end_of_input - utf8 < 3 || (((utf8[1] ^ 0x80) | (utf8[2] ^0x80) | (utf8[3] ^ 0x80)) & 0xC0)) {
276 plane = (-0xC8 + (c << 2) + (utf8[1] >> 4));
281 *p++ = (Uint16)(0xDF80 + (utf8[1] << 12) + (utf8[2] << 6) + utf8[3]);
288 *p++ = (Uint16)(0xE5B8 + (c << 8) + (utf8[1] << 2) + (utf8[2] >> 4));
289 *p++ = (Uint16)(0xDB80 + ((utf8[2] & 0x0F) << 6) + utf8[3]);
294 utf8 += 4;