diff options
Diffstat (limited to 'src/utf8.c')
-rw-r--r-- | src/utf8.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/utf8.c b/src/utf8.c new file mode 100644 index 0000000..18ca3eb --- /dev/null +++ b/src/utf8.c @@ -0,0 +1,38 @@ +/* + * utf8.c: + * + * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>, + * All rights reserved. + * + */ + +static char rcsid[] = "$Id$"; + +/* + * $Log$ + * Revision 1.1 2008/02/22 19:12:05 james + * *** empty log message *** + * + */ + +#include "project.h" + + + /*FIXME: for the moment we bodge utf8 support*/ + if ((ch>=0xc0) && (ch<0xe0)) /*Start of two byte unicode sequence*/ + { + p->in_utf8=2; + } else if ((ch>=0xe0) && (ch<0xf0)) /*Start of three byte unicode sequence*/ + { + p->in_utf8=3; + } else if ((ch>=0xf0) && (ch<0xf7)) /*Start of four byte unicode sequence*/ + p->in_utf8=4; + } + + if (p->utf_8) { + p->in_utf8--; + ch='?'; + } + + if (!p->utf_8) { + /*Not first or last byte in sequence*/ |