2009-07-28 16:01:52 +08:00
|
|
|
/*
|
2012-03-21 02:55:55 +08:00
|
|
|
* Copyright (c) 2009-2012 Petri Lehtinen <petri@digip.org>
|
2009-07-28 16:01:52 +08:00
|
|
|
*
|
|
|
|
* Jansson is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the MIT license. See LICENSE for details.
|
|
|
|
*/
|
|
|
|
|
2009-07-14 02:03:09 +08:00
|
|
|
#ifndef UTF_H
|
|
|
|
#define UTF_H
|
|
|
|
|
2010-09-05 22:16:47 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2010-02-07 03:08:56 +08:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_INTTYPES_H
|
|
|
|
/* inttypes.h includes stdint.h in a standard environment, so there's
|
|
|
|
no need to include stdint.h separately. If inttypes.h doesn't define
|
|
|
|
int32_t, it's defined in config.h. */
|
|
|
|
#include <inttypes.h>
|
2010-12-19 04:58:40 +08:00
|
|
|
#endif /* HAVE_INTTYPES_H */
|
|
|
|
|
|
|
|
#else /* !HAVE_CONFIG_H */
|
2010-09-06 02:29:04 +08:00
|
|
|
#ifdef _WIN32
|
|
|
|
typedef int int32_t;
|
2010-12-19 04:58:40 +08:00
|
|
|
#else /* !_WIN32 */
|
|
|
|
/* Assume a standard environment */
|
|
|
|
#include <inttypes.h>
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
|
|
#endif /* HAVE_CONFIG_H */
|
2010-02-07 03:08:56 +08:00
|
|
|
|
2009-07-15 01:47:57 +08:00
|
|
|
int utf8_encode(int codepoint, char *buffer, int *size);
|
|
|
|
|
2009-07-14 02:03:09 +08:00
|
|
|
int utf8_check_first(char byte);
|
2009-12-06 04:55:30 +08:00
|
|
|
int utf8_check_full(const char *buffer, int size, int32_t *codepoint);
|
|
|
|
const char *utf8_iterate(const char *buffer, int32_t *codepoint);
|
2009-07-14 02:03:09 +08:00
|
|
|
|
|
|
|
int utf8_check_string(const char *string, int length);
|
|
|
|
|
|
|
|
#endif
|