/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) 1995-2012 Index Data
* See the file LICENSE for details.
*/
/**
#include <assert.h>
#include <errno.h>
#include <string.h>
-#include <ctype.h>
#include "iconv-p.h"
}
return 0;
}
-
+
+int yaz_utf8_check(const char *str)
+{
+ /* cast OK: yaz_read_UTF8_char is read-only */
+ unsigned char *inp = (unsigned char *) str;
+ size_t inbytesleft = strlen(str);
+
+ while (inbytesleft)
+ {
+ int error = 0;
+ size_t no_read;
+ yaz_read_UTF8_char(inp, inbytesleft, &no_read, &error);
+ if (error)
+ return 0;
+ inp += no_read;
+ inbytesleft -= no_read;
+ }
+ return 1;
+}
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
+