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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
Copyright (C) 2008, 2012, 2014, 2025 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2006 Burkhard Plaum <plaum@ipf.uni-stuttgart.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \file utf8.h
*
* \brief UTF-8 support
*/
/** \brief Opaque characterset converter
*/
typedef struct cdio_charset_coverter_s cdio_charset_coverter_t;
/** \brief Create a charset converter
* \param src_charset Source charset
* \param dst_charset Destination charset
* \returns A newly allocated charset converter
*/
cdio_charset_coverter_t *
;
/** \brief Destroy a characterset converter
* \param cnv A characterset converter
*/
void ;
/** \brief Convert a string from one character set to another
* \param cnv A charset converter
* \param src Source string
* \param src_len Length of source string
* \param dst Returns destination string
* \param dst_len If non NULL, returns the length of the destination string
* \returns true if conversion was successful, false else.
*
* The destination string must be freed by the caller with cdio_free().
* If you pass -1 for src_len, strlen() will be used.
*/
bool ;
/** \brief Convert a string from UTF-8 to another charset
* \param src Source string (0 terminated)
* \param dst Returns destination string
* \param dst_len If non NULL, returns the length of the destination string
* \param dst_charset The characterset to convert to
* \returns true if conversion was successful, false else.
*
* This is a convenience function, which creates a charset converter,
* converts one string and destroys the charset converter.
*
* The destination string must be freed by the caller with cdio_free().
*/
bool ;
/** \brief Convert a string from another charset to UTF-8
* \param src Source string
* \param src_len Length of the source string
* \param dst Returns destination string (0 terminated)
* \param src_charset The characterset to convert from
1 * \returns true if conversion was successful, false else.
*
* This is a convenience function, which creates a charset converter,
* converts one string and destroys the charset converter.
*
* The destination string must be freed by the caller with cdio_free().
* If you pass -1 for src_len, strlen() will be used.
*/
bool ;
/** \brief Convert an UTF8 string to UTF-16 (allocate returned string)
* \param str Source string
* \returns NULL if the conversion was unsuccesful. Caller must free the
* returned string with cdio_free().
* This is a convenience function available on Windows platforms only.
*/
wchar_t* ;
/** \brief Provides an UTF-8 compliant version of fopen for Windows
* The parameters and return value are the same as fopen().
*/
FILE* ;