Debian Codegraph @

src/iri.h

raw
1 /* Internationalization related declarations.
2 Copyright (C) 2008-2011, 2015, 2018-2024 Free Software Foundation,
3 Inc.
4
5 This file is part of GNU Wget.
6
7 GNU Wget is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 GNU Wget is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Wget. If not, see <http://www.gnu.org/licenses/>.
19
20 Additional permission under GNU GPL version 3 section 7
21
22 If you modify this program, or any covered work, by linking or
23 combining it with the OpenSSL project's OpenSSL library (or a
24 modified version of that library), containing parts covered by the
25 terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
26 grants you additional permission to convey the resulting work.
27 Corresponding Source for a non-source form of such a combination
28 shall include the source code for the parts of OpenSSL used as well
29 as that of the covered work. */
30
31 #ifndef IRI_H
32 #define IRI_H
33
34 struct iri {
35 char *uri_encoding; /* Encoding of the uri to fetch */
36 char *content_encoding; /* Encoding of links inside the fetched file */
37 char *orig_url; /* */
38 bool utf8_encode; /* Will/Is the current url encoded in utf8 */
39 };
40
41 #ifdef ENABLE_IRI
42
43 char *parse_charset (const char *str);
44 const char *find_locale (void);
45 bool check_encoding_name (const char *encoding);
46 const char *locale_to_utf8 (const char *str);
47 char *idn_encode (const struct iri *i, const char *host);
48 char *idn_decode (const char *host);
49 bool remote_to_utf8 (const struct iri *i, const char *str, char **newstr);
50 struct iri *iri_new (void);
51 struct iri *iri_dup (const struct iri *);
52 void iri_free (struct iri *i);
53 void set_uri_encoding (struct iri *i, const char *charset, bool force);
54 void set_content_encoding (struct iri *i, const char *charset);
55
56 #else /* ENABLE_IRI */
57
58 extern struct iri dummy_iri;
59
60 #define parse_charset(str) NULL
61 #define find_locale() NULL
62 #define check_encoding_name(str) false
63 #define locale_to_utf8(str) (str)
64 #define idn_encode(a,b) NULL
65 #define idn_decode(str) NULL
66 #define idn2_free(str) ((void)0)
67 #define remote_to_utf8(a,b,c) false
68 #define iri_new() (&dummy_iri)
69 #define iri_dup(a) (&dummy_iri)
70 #define iri_free(a)
71 #define set_uri_encoding(a,b,c)
72 #define set_content_encoding(a,b)
73
74 #endif /* ENABLE_IRI */
75 #endif /* IRI_H */