4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.2 2008/02/22 23:39:27 james
14 * *** empty log message ***
16 * Revision 1.1 2008/02/22 19:12:05 james
17 * *** empty log message ***
24 void utf8_flush(Context *c)
29 for (i=0;i<u->utf_ptr;++i)
30 vt102_parse(c,u->utf_buf[i]);
36 int utf8_parse(Context *c,int ch)
41 /*FIXME: for the moment we bodge utf8 support*/
42 if (ch==0xb9) { /*CSI, not a valid utf8 start char*/
44 } else if ((ch & 0xe0) == 0xc0) { /*Start of two byte unicode sequence*/
47 u->utf_buf[u->utf_ptr++]=ch;
48 } else if ((ch & 0xf0) ==0xe0) { /*Start of three byte unicode sequence*/
51 u->utf_buf[u->utf_ptr++]=ch;
52 } else if ((ch & 0xf8) ==0xf0) {
55 u->utf_buf[u->utf_ptr++]=ch;
60 if ((ch & 0xc0) != 0x80) {
64 u->utf_buf[u->utf_ptr++]=ch;
76 ret=(UTF8 *) malloc(sizeof(UTF8));