static int input_utf8(const unsigned char *buffer, int size, unichar *result)
{
	unichar c = g_utf8_get_char_validated((char *)buffer, size);

	switch (c) {
	case (unichar)-1:
		/* not UTF8 - fallback to 8bit ascii */
		*result = *buffer;
		return 1;
	case (unichar)-2:
                /* need more data */
		return -1;
	default:
		*result = c;
		return g_utf8_skip[*buffer];
	}
}
static int input_utf8(const unsigned char *buffer, int size, unichar *result)
{
	unichar c = g_utf8_get_char_validated((char *)buffer, size);

	switch (c) {
	case (unichar)-1:
		 
		*result = *buffer;
		return 1;
	case (unichar)-2:
                 
		return -1;
	default:
		*result = c;
		return g_utf8_skip[*buffer];
	}
}