1 /* Message list character set conversion.
2 Copyright (C) 2001-2003, 2005-2006, 2009, 2015 Free Software
4 Written by Bruno Haible <haible@clisp.cons.org>, 2001.
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
37 /* A context, used for accurate error messages. */
38 struct conversion_context
40 const char *from_code; /* canonicalized encoding name for input */
41 const char *to_code; /* canonicalized encoding name for output */
42 const char *from_filename; /* file name where the input comes from */
43 const message_ty *message; /* message being converted, or NULL */
46 /* Converts the STRING through the conversion descriptor CD.
47 Assumes that either FROM_CODE or TO_CODE is UTF-8. */
48 extern char *convert_string_directly (iconv_t cd, const char *string,
49 const struct conversion_context* context);
53 /* Converts the message list MLP to the (already canonicalized) encoding
54 CANON_TO_CODE. The (already canonicalized) encoding before conversion
55 can be passed as CANON_FROM_CODE; if NULL is passed instead, the
56 encoding is looked up in the header entry. Returns true if and only if
57 some msgctxt or msgid changed due to the conversion. */
59 iconv_message_list (message_list_ty *mlp,
60 const char *canon_from_code,
61 const char *canon_to_code,
62 const char *from_filename);
64 /* Converts all the message lists in MDLP to the encoding TO_CODE.
65 UPDATE_HEADER specifies whether to update the "charset=..." specification
66 in the header; it should normally be true. */
67 extern msgdomain_list_ty *
68 iconv_msgdomain_list (msgdomain_list_ty *mdlp,
71 const char *from_filename);
73 /* Tests whether the message list MLP could be converted to CANON_TO_CODE.
74 The (already canonicalized) encoding before conversion can be passed as
75 CANON_FROM_CODE; if NULL is passed instead, the encoding is looked up
76 in the header entry. */
78 is_message_list_iconvable (message_list_ty *mlp,
79 const char *canon_from_code,
80 const char *canon_to_code);
88 #endif /* _MSGL_ICONV_H */