Libparserutils
utf8.h
Go to the documentation of this file.
1/*
2 * This file is part of LibParserUtils.
3 * Licensed under the MIT License,
4 * http://www.opensource.org/licenses/mit-license.php
5 * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
6 */
7
12#ifndef parserutils_charset_utf8_h_
13#define parserutils_charset_utf8_h_
14
15#ifdef __cplusplus
16extern "C"
17{
18#endif
19
20#include <inttypes.h>
21
22#include <parserutils/errors.h>
23
25 uint32_t *ucs4, size_t *clen);
27 size_t *len);
28
30 size_t *len);
32 size_t *len);
33
34parserutils_error parserutils_charset_utf8_prev(const uint8_t *s, uint32_t off,
35 uint32_t *prevoff);
36parserutils_error parserutils_charset_utf8_next(const uint8_t *s, uint32_t len,
37 uint32_t off, uint32_t *nextoff);
38
40 uint32_t len, uint32_t off, uint32_t *nextoff);
41
42#ifdef __cplusplus
43}
44#endif
45
46#endif
47
size_t len
Definition: codec_8859.c:23
parserutils_error
Definition: errors.h:18
parserutils_error parserutils_charset_utf8_length(const uint8_t *s, size_t max, size_t *len)
Calculate the length (in characters) of a bounded UTF-8 string.
Definition: utf8.c:90
parserutils_error parserutils_charset_utf8_from_ucs4(uint32_t ucs4, uint8_t **s, size_t *len)
Convert a single UCS-4 character into a UTF-8 multibyte sequence.
Definition: utf8.c:72
parserutils_error parserutils_charset_utf8_next_paranoid(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff)
Find next legal UTF-8 char in string.
Definition: utf8.c:166
parserutils_error parserutils_charset_utf8_to_ucs4(const uint8_t *s, size_t len, uint32_t *ucs4, size_t *clen)
Convert a UTF-8 multibyte sequence into a single UCS-4 character.
Definition: utf8.c:51
parserutils_error parserutils_charset_utf8_next(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff)
Find next legal UTF-8 char in string.
Definition: utf8.c:146
parserutils_error parserutils_charset_utf8_prev(const uint8_t *s, uint32_t off, uint32_t *prevoff)
Find previous legal UTF-8 char in string.
Definition: utf8.c:126
parserutils_error parserutils_charset_utf8_char_byte_length(const uint8_t *s, size_t *len)
Calculate the length (in bytes) of a UTF-8 character.
Definition: utf8.c:107
#define max(a, b)
Definition: utils.h:12