2 * Copyright notice from original mutt:
5 * This file is part of mutt-ng, see http://www.muttng.org/.
6 * It's licensed under the GNU General Public License,
7 * please see the file GPL in the top level source directory.
22 int mutt_wctoutf8(char *p, unsigned int c)
24 static unsigned char const mark[7] = {
25 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
35 bytes = 1 + (c >= 0x80) + (c >= 0x800) + (c >= 0x10000);
39 case 4: *--p = (c | 0x80) & 0xbf; c >>= 6;
40 case 3: *--p = (c | 0x80) & 0xbf; c >>= 6;
41 case 2: *--p = (c | 0x80) & 0xbf; c >>= 6;
42 case 1: *--p = c | mark[bytes];
48 #endif /* !HAVE_WC_FUNCS */