summaryrefslogtreecommitdiffstats
path: root/utf8.h
blob: 255a47f00ba607ab27c45bfed856bd26bb36b2be (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* ################################################################### */
/* Copyright 2015, Pierre Gentile (p.gen.progs@gmail.com)              */
/*                                                                     */
/* This Source Code Form is subject to the terms of the Mozilla Public */
/* License, v. 2.0. If a copy of the MPL was not distributed with this */
/* file, You can obtain one at https://mozilla.org/MPL/2.0/.           */
/* ################################################################### */

#ifndef UTF8_H
#define UTF8_H

#include <stdint.h>

typedef struct langinfo_s langinfo_t;

/* Locale informations */
/* """"""""""""""""""" */
struct langinfo_s
{
  int utf8; /* charset is UTF-8              */
  int bits; /* number of bits in the charset */
};

int
utf8_get_length(unsigned char c);

size_t
utf8_offset(char *, size_t);

char *
utf8_strprefix(char * d, char * s, long n, long * pos);

size_t
utf8_strlen(char * str);

wchar_t *
utf8_strtowcs(char * s);

void
utf8_sanitize(char * s, char sc);

int
cptoutf8(char * utf8_str, uint32_t c);

int
utf8_interpret(char * s, char sc);

char *
utf8_validate(char * str);

char *
utf8_prev(const char * str, const char * p);

char *
utf8_next(char * p);

void
utf8_strtolower(char * dst, char * src);

#endif