aboutsummaryrefslogtreecommitdiffstats
path: root/src/utf8.c
blob: 18ca3ebeab5e647126a6801d7ae2e2c032e66e64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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*/