1 /* $NetBSD: iconvchk.c,v 1.4 2014/12/10 04:37:56 christos Exp $ */
4 static char *rcsid
= "Id: iconvchk.c,v 1.1 2003/06/04 00:26:54 marka Exp ";
8 * Copyright (c) 2002 Japan Network Information Center.
11 * By using this file, you agree to the terms and conditions set forth bellow.
13 * LICENSE TERMS AND CONDITIONS
15 * The following License Terms and Conditions apply, unless a different
16 * license is obtained from Japan Network Information Center ("JPNIC"),
17 * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
18 * Chiyoda-ku, Tokyo 101-0047, Japan.
20 * 1. Use, Modification and Redistribution (including distribution of any
21 * modified or derived work) in source and/or binary forms is permitted
22 * under this License Terms and Conditions.
24 * 2. Redistribution of source code must retain the copyright notices as they
25 * appear in each source code file, this License Terms and Conditions.
27 * 3. Redistribution in binary form must reproduce the Copyright Notice,
28 * this License Terms and Conditions, in the documentation and/or other
29 * materials provided with the distribution. For the purposes of binary
30 * distribution the "Copyright Notice" refers to the following language:
31 * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
33 * 4. The name of JPNIC may not be used to endorse or promote products
34 * derived from this Software without specific prior written approval of
37 * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
38 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
39 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
40 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
41 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
43 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
44 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
45 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
46 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
47 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
54 #include <idn/converter.h>
55 #include <idn/result.h>
59 #define IDN_UTF8_ENCODING_NAME "UTF-8"
65 idn_converter_t eucjp_ctx
= NULL
;
68 if (r
!= idn_success
) {
69 fprintf(stderr
, "idn_nameinit(): failed\n");
73 r
= idn_converter_create(EUCJP_ENCODING_NAME
, &eucjp_ctx
, 0);
75 if (eucjp_ctx
!= NULL
) {
76 idn_converter_destroy(eucjp_ctx
);
79 if (r
!= idn_success
) {
80 if (r
== idn_invalid_name
) {
82 "\"%s\" is invalid codeset name, edit codeset.h\n", \
87 "idn_converter_create() failed with error \"%s\"\n", \
88 idn_result_tostring(r
));
98 idn_converter_t sjis_ctx
= NULL
;
101 if (r
!= idn_success
) {
102 fprintf(stderr
, "idn_nameinit(): failed\n");
106 r
= idn_converter_create(SJIS_ENCODING_NAME
, &sjis_ctx
, 0);
108 if (sjis_ctx
!= NULL
) {
109 idn_converter_destroy(sjis_ctx
);
112 if (r
!= idn_success
) {
113 if (r
== idn_invalid_name
) {
115 "\"%s\" is invalid codeset name, edit codeset.h\n", \
120 "idn_converter_create() failed with error \"%s\"\n", \
121 idn_result_tostring(r
));
128 main (int ac
, char **av
)