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 *s, unsigned int c)
29 else if (c < (1 << 11)) {
31 *s++ = 0xc0 | (c >> 6);
32 *s++ = 0x80 | (c & 0x3f);
36 else if (c < (1 << 16)) {
38 *s++ = 0xe0 | (c >> 12);
39 *s++ = 0x80 | ((c >> 6) & 0x3f);
40 *s++ = 0x80 | (c & 0x3f);
44 else if (c < (1 << 21)) {
46 *s++ = 0xf0 | (c >> 18);
47 *s++ = 0x80 | ((c >> 12) & 0x3f);
48 *s++ = 0x80 | ((c >> 6) & 0x3f);
49 *s++ = 0x80 | (c & 0x3f);
53 else if (c < (1 << 26)) {
55 *s++ = 0xf8 | (c >> 24);
56 *s++ = 0x80 | ((c >> 18) & 0x3f);
57 *s++ = 0x80 | ((c >> 12) & 0x3f);
58 *s++ = 0x80 | ((c >> 6) & 0x3f);
59 *s++ = 0x80 | (c & 0x3f);
63 else if (c < (1 << 31)) {
65 *s++ = 0xfc | (c >> 30);
66 *s++ = 0x80 | ((c >> 24) & 0x3f);
67 *s++ = 0x80 | ((c >> 18) & 0x3f);
68 *s++ = 0x80 | ((c >> 12) & 0x3f);
69 *s++ = 0x80 | ((c >> 6) & 0x3f);
70 *s++ = 0x80 | (c & 0x3f);
78 #endif /* !HAVE_WC_FUNCS */