1 /*
2  * Copyright (c) 2003, Artem B. Bityuckiy, SoftMine Corporation.
3  * Rights transferred to Franklin Electronic Publishers.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  */
26 #include <stdio.h>
27 #include <iconv.h>
28 #include <errno.h>
29 #include "check.h"
30 
31 #if defined(_ICONV_FROM_ENCODING_UTF_8) || \
32     defined(_ICONV_FROM_ENCODING_EUC_JP) || \
33     defined(_ICONV_FROM_ENCODING_SHIFT_JIS) || \
34     defined(_ICONV_FROM_ENCODING_UCS_2_INTERNAL)
35 
36 #ifdef _ICONV_FROM_ENCODING_UTF_8
37 static const char utf8[] =
38 {
39     0xe8,0x89,0xb2,0xe3,0x80,0x85,0xe3,0x83,0x86,0xe3,
40     0x82,0xad,0xe3,0x82,0xb9,0xe3,0x83,0x88,0xe3,0x83,
41     0x95,0xe3,0x82,0xa1,0xe3,0x82,0xa4,0xe3,0x83,0xab,
42     0xe9,0x9b,0x86,0x20,0x56,0x65,0x72,0x33,0x2e,0x33,
43     0x20,0x28,0x43,0x29,0x48,0x41,0x54,0x0d,0x0a,0x0d,
44     0x0a,0xe3,0x81,0x93,0xe3,0x81,0xae,0xe3,0x82,0xa2,
45     0xe3,0x83,0xbc,0xe3,0x82,0xab,0xe3,0x82,0xa4,0xe3,
46     0x83,0x96,0xe3,0x81,0xae,0xe6,0x9c,0x80,0xe6,0x96,
47     0xb0,0xe7,0x89,0x88,0xe3,0x81,0xaf,0xe3,0x81,0x93,
48     0xe3,0x81,0x93,0xe3,0x81,0xab,0xe3,0x81,0x82,0xe3,
49     0x82,0x8a,0xe3,0x81,0xbe,0xe3,0x81,0x99,0xe3,0x80,
50     0x82,0x0d,0x0a,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,
51     0x77,0x77,0x77,0x30,0x32,0x2e,0x73,0x6f,0x2d,0x6e,
52     0x65,0x74,0x2e,0x6e,0x65,0x2e,0x6a,0x70,0x2f,0x25,
53     0x37,0x45,0x68,0x61,0x74,0x2f,0x66,0x69,0x6c,0x65,
54     0x73,0x2f,0x69,0x6e,0x64,0x65,0x78,0x2d,0x6a,0x2e,
55     0x68,0x74,0x6d,0x6c,0x0d,0x0a,0x0d,0x0a,0x63,0x72,
56     0x2c,0x20,0x63,0x72,0x6c,0x66,0x2c,0x20,0x6c,0x66,
57     0xe3,0x83,0x87,0xe3,0x82,0xa3,0xe3,0x83,0xac,0xe3,
58     0x82,0xaf,0xe3,0x83,0x88,0xe3,0x83,0xaa,0x28,0xe3,
59     0x83,0x95,0xe3,0x82,0xa9,0xe3,0x83,0xab,0xe3,0x83,
60     0x80,0x29,0xe3,0x81,0xae,0xe5,0x86,0x85,0xe5,0xae,
61     0xb9,0xe3,0x81,0xaf,0xe5,0x90,0x8c,0xe3,0x81,0x98,
62     0xe3,0x81,0xa7,0xe3,0x81,0x99,0xe3,0x81,0x8c,0xe3,
63     0x80,0x81,0xe8,0xa1,0x8c,0xe3,0x81,0xae,0xe5,0x8c,
64     0xba,0xe5,0x88,0x87,0xe3,0x82,0x8a,0xe3,0x81,0x8c,
65     0xe3,0x81,0x9d,0xe3,0x82,0x8c,0xe3,0x81,0x9e,0xe3,
66     0x82,0x8c,0x0d,0x0a,0x43,0x52,0x28,0x4d,0x61,0x63,
67     0xe9,0xa2,0xa8,0x29,0xe3,0x80,0x81,0x43,0x52,0x2b,
68     0x4c,0x46,0x28,0x44,0x4f,0x53,0xe9,0xa2,0xa8,0x29,
69     0xe3,0x80,0x81,0x4c,0x46,0x28,0x55,0x4e,0x49,0x58,
70     0xe9,0xa2,0xa8,0x29,0xe3,0x81,0xab,0xe3,0x81,0xaa,
71     0xe3,0x81,0xa3,0xe3,0x81,0xa6,0xe3,0x81,0x84,0xe3,
72     0x81,0xbe,0xe3,0x81,0x99,0xe3,0x80,0x82,0x0d,0x0a,
73     0x0d,0x0a,0x0d,0x0a,0x6a,0x74,0x65,0x78,0x74,0x2f,
74     0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x72,0x65,0x61,0x64,
75     0x6d,0x65,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
76     0x20,0xe8,0x8b,0xb1,0xe8,0xaa,0x9e,0x52,0x45,0x41,
77     0x44,0x4d,0x45,0x20,0x20,0x20,0x20,0x20,0x28,0x41,
78     0x53,0x43,0x49,0x49,0x29,0x0d,0x0a,0x20,0x20,0x72,
79     0x65,0x61,0x64,0x6d,0x65,0x2e,0x65,0x75,0x63,0x20,
80     0x2d,0x2d,0x2d,0x20,0xe3,0x81,0x93,0xe3,0x81,0xae,
81     0xe3,0x83,0x95,0xe3,0x82,0xa1,0xe3,0x82,0xa4,0xe3,
82     0x83,0xab,0x20,0x20,0x20,0x28,0x45,0x55,0x43,0x2d,
83     0x4a,0x50,0x29,0x0d,0x0a,0x20,0x20,0x72,0x65,0x61,
84     0x64,0x6d,0x65,0x2e,0x6a,0x69,0x73,0x20,0x2d,0x2d,
85     0x2d,0x20,0xe6,0x97,0xa5,0xe6,0x9c,0xac,0xe8,0xaa,
86     0x9e,0x52,0x45,0x41,0x44,0x4d,0x45,0x20,0x20,0x20,
87     0x28,0x4a,0x49,0x53,0x29,0x0d,0x0a,0x20,0x20,0x72,
88     0x65,0x61,0x64,0x6d,0x65,0x2e,0x73,0x6a,0x73,0x20,
89     0x2d,0x2d,0x2d,0x20,0xe6,0x97,0xa5,0xe6,0x9c,0xac,
90     0xe8,0xaa,0x9e,0x52,0x45,0x41,0x44,0x4d,0x45,0x20,
91     0x20,0x20,0x28,0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,
92     0x49,0x53,0x29,0x0d,0x0a,0x0d,0x0a,0x6a,0x74,0x65,
93     0x78,0x74,0x2f,0x63,0x72,0x2f,0x0d,0x0a,0x6a,0x74,
94     0x65,0x78,0x74,0x2f,0x63,0x72,0x6c,0x66,0x2f,0x0d,
95     0x0a,0x6a,0x74,0x65,0x78,0x74,0x2f,0x6c,0x66,0x2f,
96     0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x61,0x73,0x63,0x69,
97     0x69,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,0x2d,
98     0x20,0x41,0x53,0x43,0x49,0x49,0xe3,0x81,0xa7,0xe6,
99     0x9b,0xb8,0xe3,0x81,0x84,0xe3,0x81,0x9f,0xe6,0x97,
100     0xa5,0xe6,0x9c,0xac,0xe8,0xaa,0x9e,0x28,0xe3,0x83,
101     0xad,0xe3,0x83,0xbc,0xe3,0x83,0x9e,0xe5,0xad,0x97,
102     0x29,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x6a,0x30,0x32,
103     0x30,0x31,0x2d,0x38,0x62,0x2e,0x74,0x78,0x74,0x20,
104     0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,0x30,
105     0x31,0xe3,0x81,0xae,0xe7,0x89,0x87,0xe4,0xbb,0xae,
106     0xe5,0x90,0x8d,0x20,0xe3,0x82,0x92,0x20,0x38,0xe5,
107     0x8d,0x98,0xe4,0xbd,0x8d,0xe7,0xac,0xa6,0xe5,0x8f,
108     0xb7,0xe5,0x8c,0x96,0x20,0x20,0x20,0x20,0x20,0x20,
109     0x20,0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,0x49,0x53,
110     0xe3,0x81,0xa8,0xe5,0x90,0x8c,0xe3,0x81,0x98,0x0d,
111     0x0a,0x20,0x20,0x6a,0x30,0x32,0x30,0x31,0x2d,0x65,
112     0x73,0x2e,0x74,0x78,0x74,0x20,0x2d,0x20,0x4a,0x49,
113     0x53,0x20,0x58,0x30,0x32,0x30,0x31,0xe3,0x81,0xae,
114     0xe7,0x89,0x87,0xe4,0xbb,0xae,0xe5,0x90,0x8d,0x20,
115     0xe3,0x82,0x92,0x20,0x45,0x53,0x43,0x28,0x49,0xe3,
116     0x81,0xa7,0xe7,0xac,0xa6,0xe5,0x8f,0xb7,0xe5,0x8c,
117     0x96,0x0d,0x0a,0x20,0x20,0x6a,0x30,0x32,0x30,0x31,
118     0x2d,0x73,0x6f,0x2e,0x74,0x78,0x74,0x20,0x2d,0x20,
119     0x4a,0x49,0x53,0x20,0x58,0x30,0x32,0x30,0x31,0xe3,
120     0x81,0xae,0xe7,0x89,0x87,0xe4,0xbb,0xae,0xe5,0x90,
121     0x8d,0x20,0xe3,0x82,0x92,0x20,0x53,0x4f,0x2f,0x53,
122     0x49,0xe3,0x81,0xa7,0xe7,0xac,0xa6,0xe5,0x8f,0xb7,
123     0xe5,0x8c,0x96,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x6a,
124     0x30,0x32,0x30,0x38,0x2d,0x38,0x62,0x2e,0x74,0x78,
125     0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,
126     0x32,0x30,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
127     0x20,0x20,0xe3,0x82,0x92,0x20,0x38,0xe5,0x8d,0x98,
128     0xe4,0xbd,0x8d,0xe7,0xac,0xa6,0xe5,0x8f,0xb7,0xe5,
129     0x8c,0x96,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x45,
130     0x55,0x43,0x2d,0x4a,0x50,0xe3,0x81,0xa8,0xe5,0x90,
131     0x8c,0xe3,0x81,0x98,0x0d,0x0a,0x20,0x20,0x6a,0x30,
132     0x32,0x30,0x38,0x2d,0x37,0x38,0x2e,0x74,0x78,0x74,
133     0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,
134     0x30,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
135     0x20,0xe3,0x82,0x92,0x20,0x45,0x53,0x43,0x24,0x40,
136     0xe3,0x81,0xa7,0xe7,0xac,0xa6,0xe5,0x8f,0xb7,0xe5,
137     0x8c,0x96,0x20,0x20,0x20,0x20,0x20,0xe3,0x81,0x84,
138     0xe3,0x82,0x8f,0xe3,0x82,0x86,0xe3,0x82,0x8b,0xe6,
139     0x97,0xa7,0x4a,0x49,0x53,0x0d,0x0a,0x20,0x20,0x6a,
140     0x30,0x32,0x30,0x38,0x2d,0x38,0x33,0x2e,0x74,0x78,
141     0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,
142     0x32,0x30,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
143     0x20,0x20,0xe3,0x82,0x92,0x20,0x45,0x53,0x43,0x24,
144     0x42,0xe3,0x81,0xa7,0xe7,0xac,0xa6,0xe5,0x8f,0xb7,
145     0xe5,0x8c,0x96,0x20,0x20,0x20,0x20,0x20,0xe3,0x81,
146     0x84,0xe3,0x82,0x8f,0xe3,0x82,0x86,0xe3,0x82,0x8b,
147     0xe6,0x96,0xb0,0x4a,0x49,0x53,0x0d,0x0a,0x0d,0x0a,
148     0x20,0x20,0x65,0x30,0x32,0x30,0x31,0x2e,0x74,0x78,
149     0x74,0x20,0x2d,0x2d,0x2d,0x2d,0x20,0x4a,0x49,0x53,
150     0x20,0x58,0x30,0x32,0x30,0x31,0xe3,0x81,0xae,0xe7,
151     0x89,0x87,0xe4,0xbb,0xae,0xe5,0x90,0x8d,0x20,0xe3,
152     0x82,0x92,0x20,0x45,0x55,0x43,0x2d,0x4a,0x50,0xe3,
153     0x81,0xa7,0xe7,0xac,0xa6,0xe5,0x8f,0xb7,0xe5,0x8c,
154     0x96,0x0d,0x0a,0x20,0x20,0x65,0x30,0x32,0x30,0x38,
155     0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,0x2d,0x20,
156     0x4a,0x49,0x53,0x20,0x58,0x30,0x32,0x30,0x38,0x20,
157     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xe3,0x82,
158     0x92,0x20,0x45,0x55,0x43,0x2d,0x4a,0x50,0xe3,0x81,
159     0xa7,0xe7,0xac,0xa6,0xe5,0x8f,0xb7,0xe5,0x8c,0x96,
160     0x20,0x20,0x20,0x20,0x38,0xe3,0x83,0x93,0xe3,0x83,
161     0x83,0xe3,0x83,0x88,0x4a,0x49,0x53,0x58,0x30,0x32,
162     0x30,0x38,0xe3,0x81,0xa8,0xe5,0x90,0x8c,0xe3,0x81,
163     0x98,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x73,0x30,0x32,
164     0x30,0x31,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
165     0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,0x30,
166     0x31,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
167     0xe3,0x82,0x92,0x20,0x53,0x68,0x69,0x66,0x74,0x5f,
168     0x4a,0x49,0x53,0xe3,0x81,0xa7,0xe7,0xac,0xa6,0xe5,
169     0x8f,0xb7,0xe5,0x8c,0x96,0x20,0x38,0xe3,0x83,0x93,
170     0xe3,0x83,0x83,0xe3,0x83,0x88,0x4a,0x49,0x53,0x58,
171     0x30,0x32,0x30,0x31,0xe3,0x81,0xa8,0xe5,0x90,0x8c,
172     0xe3,0x81,0x98,0x0d,0x0a,0x20,0x20,0x73,0x30,0x32,
173     0x30,0x38,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
174     0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,0x30,
175     0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
176     0xe3,0x82,0x92,0x20,0x53,0x68,0x69,0x66,0x74,0x5f,
177     0x4a,0x49,0x53,0xe3,0x81,0xa7,0xe7,0xac,0xa6,0xe5,
178     0x8f,0xb7,0xe5,0x8c,0x96,0x0d,0x0a,0x0d,0x0a,0x6a,
179     0x74,0x65,0x78,0x74,0x2f,0x6f,0x74,0x68,0x65,0x72,
180     0x73,0x2f,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x62,0x36,
181     0x34,0x6a,0x69,0x73,0x2e,0x74,0x78,0x74,0x20,0x2d,
182     0x2d,0x2d,0x20,0x49,0x53,0x4f,0x2d,0x32,0x30,0x32,
183     0x32,0x2d,0x4a,0x50,0x20,0x28,0x4a,0x49,0x53,0x29,
184     0x20,0xe3,0x82,0x92,0x20,0x62,0x61,0x73,0x65,0x36,
185     0x34,0xe3,0x81,0xa7,0xe7,0xac,0xa6,0xe5,0x8f,0xb7,
186     0xe5,0x8c,0x96,0x0d,0x0a,0x20,0x20,0x71,0x74,0x6a,
187     0x69,0x73,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
188     0x2d,0x20,0x49,0x53,0x4f,0x2d,0x32,0x30,0x32,0x32,
189     0x2d,0x4a,0x50,0x20,0x28,0x4a,0x49,0x53,0x29,0x20,
190     0xe3,0x82,0x92,0x20,0x71,0x75,0x6f,0x74,0x65,0x64,
191     0x2d,0x70,0x72,0x69,0x6e,0x74,0x61,0x62,0x6c,0x65,
192     0xe3,0x81,0xa7,0xe7,0xac,0xa6,0xe5,0x8f,0xb7,0xe5,
193     0x8c,0x96,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x62,0x6b,
194     0x65,0x75,0x63,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,
195     0x2d,0x2d,0x20,0xe5,0xa3,0x8a,0xe3,0x82,0x8c,0xe3,
196     0x81,0x9f,0x45,0x55,0x43,0x2d,0x4a,0x50,0x20,0x20,
197     0x20,0x20,0x20,0x20,0xe5,0x85,0x88,0xe9,0xa0,0xad,
198     0xe3,0x83,0x93,0xe3,0x83,0x83,0xe3,0x83,0x88,0xe3,
199     0x81,0x8c,0xe3,0x82,0xbc,0xe3,0x83,0xad,0x0d,0x0a,
200     0x20,0x20,0x62,0x6b,0x6a,0x69,0x73,0x2e,0x74,0x78,
201     0x74,0x20,0x2d,0x2d,0x2d,0x2d,0x20,0xe5,0xa3,0x8a,
202     0xe3,0x82,0x8c,0xe3,0x81,0x9f,0x4a,0x49,0x53,0x20,
203     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x45,0x53,
204     0x43,0xe3,0x82,0xb3,0xe3,0x83,0xbc,0xe3,0x83,0x89,
205     0xe3,0x81,0x8c,0xe6,0xac,0xa0,0xe3,0x81,0x91,0xe3,
206     0x81,0x9f,0x0d,0x0a,0x20,0x20,0x62,0x6b,0x73,0x6a,
207     0x69,0x73,0x2e,0x74,0x78,0x74,0x2d,0x2d,0x2d,0x2d,
208     0x20,0xe5,0xa3,0x8a,0xe3,0x82,0x8c,0xe3,0x81,0x9f,
209     0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,0x49,0x53,0x20,
210     0x20,0x20,0xe5,0x85,0x88,0xe9,0xa0,0xad,0xe3,0x83,
211     0x93,0xe3,0x83,0x83,0xe3,0x83,0x88,0xe3,0x81,0x8c,
212     0xe3,0x82,0xbc,0xe3,0x83,0xad,0x0d,0x0a,0x0d,0x0a,
213     0x20,0x20,0x63,0x74,0x72,0x6c,0x5f,0x7a,0x2e,0x74,
214     0x78,0x74,0x20,0x20,0x20,0x20,0x20,0x53,0x68,0x69,
215     0x66,0x74,0x5f,0x4a,0x49,0x53,0x20,0x20,0x20,0x20,
216     0x20,0x20,0x5e,0x5a,0xe3,0x82,0xad,0xe3,0x83,0xa3,
217     0xe3,0x83,0xa9,0xe3,0x82,0xaf,0xe3,0x82,0xbf,0xe4,
218     0xbb,0x98,0xe3,0x81,0x8d,0x20,0x20,0x20,0x28,0x44,
219     0x4f,0x53,0xe9,0xa2,0xa8,0x29,0x0d,0x0a,0x20,0x20,
220     0x6d,0x61,0x63,0x74,0x78,0x74,0x2e,0x62,0x69,0x6e,
221     0x20,0x20,0x20,0x20,0x20,0xe3,0x83,0x9e,0xe3,0x83,
222     0x83,0xe3,0x82,0xaf,0xe3,0x83,0x90,0xe3,0x82,0xa4,
223     0xe3,0x83,0x8a,0xe3,0x83,0xaa,0x49,0x49,0xe3,0x83,
224     0x95,0xe3,0x82,0xa9,0xe3,0x83,0xbc,0xe3,0x83,0x9e,
225     0xe3,0x83,0x83,0xe3,0x83,0x88,0x0d,0xa
226  };
227 #endif /* ifdef _ICONV_FROM_ENCODING_UTF_8 */
228 
229 #ifdef _ICONV_FROM_ENCODING_EUC_JP
230  static const char euc_jp[] =
231  {
232     0xbf,0xa7,0xa1,0xb9,0xa5,0xc6,0xa5,0xad,0xa5,0xb9,
233     0xa5,0xc8,0xa5,0xd5,0xa5,0xa1,0xa5,0xa4,0xa5,0xeb,
234     0xbd,0xb8,0x20,0x56,0x65,0x72,0x33,0x2e,0x33,0x20,
235     0x28,0x43,0x29,0x48,0x41,0x54,0x0d,0x0a,0x0d,0x0a,
236     0xa4,0xb3,0xa4,0xce,0xa5,0xa2,0xa1,0xbc,0xa5,0xab,
237     0xa5,0xa4,0xa5,0xd6,0xa4,0xce,0xba,0xc7,0xbf,0xb7,
238     0xc8,0xc7,0xa4,0xcf,0xa4,0xb3,0xa4,0xb3,0xa4,0xcb,
239     0xa4,0xa2,0xa4,0xea,0xa4,0xde,0xa4,0xb9,0xa1,0xa3,
240     0x0d,0x0a,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,
241     0x77,0x77,0x30,0x32,0x2e,0x73,0x6f,0x2d,0x6e,0x65,
242     0x74,0x2e,0x6e,0x65,0x2e,0x6a,0x70,0x2f,0x25,0x37,
243     0x45,0x68,0x61,0x74,0x2f,0x66,0x69,0x6c,0x65,0x73,
244     0x2f,0x69,0x6e,0x64,0x65,0x78,0x2d,0x6a,0x2e,0x68,
245     0x74,0x6d,0x6c,0x0d,0x0a,0x0d,0x0a,0x63,0x72,0x2c,
246     0x20,0x63,0x72,0x6c,0x66,0x2c,0x20,0x6c,0x66,0xa5,
247     0xc7,0xa5,0xa3,0xa5,0xec,0xa5,0xaf,0xa5,0xc8,0xa5,
248     0xea,0x28,0xa5,0xd5,0xa5,0xa9,0xa5,0xeb,0xa5,0xc0,
249     0x29,0xa4,0xce,0xc6,0xe2,0xcd,0xc6,0xa4,0xcf,0xc6,
250     0xb1,0xa4,0xb8,0xa4,0xc7,0xa4,0xb9,0xa4,0xac,0xa1,
251     0xa2,0xb9,0xd4,0xa4,0xce,0xb6,0xe8,0xc0,0xda,0xa4,
252     0xea,0xa4,0xac,0xa4,0xbd,0xa4,0xec,0xa4,0xbe,0xa4,
253     0xec,0x0d,0x0a,0x43,0x52,0x28,0x4d,0x61,0x63,0xc9,
254     0xf7,0x29,0xa1,0xa2,0x43,0x52,0x2b,0x4c,0x46,0x28,
255     0x44,0x4f,0x53,0xc9,0xf7,0x29,0xa1,0xa2,0x4c,0x46,
256     0x28,0x55,0x4e,0x49,0x58,0xc9,0xf7,0x29,0xa4,0xcb,
257     0xa4,0xca,0xa4,0xc3,0xa4,0xc6,0xa4,0xa4,0xa4,0xde,
258     0xa4,0xb9,0xa1,0xa3,0x0d,0x0a,0x0d,0x0a,0x0d,0x0a,
259     0x6a,0x74,0x65,0x78,0x74,0x2f,0x0d,0x0a,0x0d,0x0a,
260     0x20,0x20,0x72,0x65,0x61,0x64,0x6d,0x65,0x2e,0x74,
261     0x78,0x74,0x20,0x2d,0x2d,0x2d,0x20,0xb1,0xd1,0xb8,
262     0xec,0x52,0x45,0x41,0x44,0x4d,0x45,0x20,0x20,0x20,
263     0x20,0x20,0x28,0x41,0x53,0x43,0x49,0x49,0x29,0x0d,
264     0x0a,0x20,0x20,0x72,0x65,0x61,0x64,0x6d,0x65,0x2e,
265     0x65,0x75,0x63,0x20,0x2d,0x2d,0x2d,0x20,0xa4,0xb3,
266     0xa4,0xce,0xa5,0xd5,0xa5,0xa1,0xa5,0xa4,0xa5,0xeb,
267     0x20,0x20,0x20,0x28,0x45,0x55,0x43,0x2d,0x4a,0x50,
268     0x29,0x0d,0x0a,0x20,0x20,0x72,0x65,0x61,0x64,0x6d,
269     0x65,0x2e,0x6a,0x69,0x73,0x20,0x2d,0x2d,0x2d,0x20,
270     0xc6,0xfc,0xcb,0xdc,0xb8,0xec,0x52,0x45,0x41,0x44,
271     0x4d,0x45,0x20,0x20,0x20,0x28,0x4a,0x49,0x53,0x29,
272     0x0d,0x0a,0x20,0x20,0x72,0x65,0x61,0x64,0x6d,0x65,
273     0x2e,0x73,0x6a,0x73,0x20,0x2d,0x2d,0x2d,0x20,0xc6,
274     0xfc,0xcb,0xdc,0xb8,0xec,0x52,0x45,0x41,0x44,0x4d,
275     0x45,0x20,0x20,0x20,0x28,0x53,0x68,0x69,0x66,0x74,
276     0x5f,0x4a,0x49,0x53,0x29,0x0d,0x0a,0x0d,0x0a,0x6a,
277     0x74,0x65,0x78,0x74,0x2f,0x63,0x72,0x2f,0x0d,0x0a,
278     0x6a,0x74,0x65,0x78,0x74,0x2f,0x63,0x72,0x6c,0x66,
279     0x2f,0x0d,0x0a,0x6a,0x74,0x65,0x78,0x74,0x2f,0x6c,
280     0x66,0x2f,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x61,0x73,
281     0x63,0x69,0x69,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,
282     0x2d,0x2d,0x20,0x41,0x53,0x43,0x49,0x49,0xa4,0xc7,
283     0xbd,0xf1,0xa4,0xa4,0xa4,0xbf,0xc6,0xfc,0xcb,0xdc,
284     0xb8,0xec,0x28,0xa5,0xed,0xa1,0xbc,0xa5,0xde,0xbb,
285     0xfa,0x29,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x6a,0x30,
286     0x32,0x30,0x31,0x2d,0x38,0x62,0x2e,0x74,0x78,0x74,
287     0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,
288     0x30,0x31,0xa4,0xce,0xca,0xd2,0xb2,0xbe,0xcc,0xbe,
289     0x20,0xa4,0xf2,0x20,0x38,0xc3,0xb1,0xb0,0xcc,0xc9,
290     0xe4,0xb9,0xe6,0xb2,0xbd,0x20,0x20,0x20,0x20,0x20,
291     0x20,0x20,0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,0x49,
292     0x53,0xa4,0xc8,0xc6,0xb1,0xa4,0xb8,0x0d,0x0a,0x20,
293     0x20,0x6a,0x30,0x32,0x30,0x31,0x2d,0x65,0x73,0x2e,
294     0x74,0x78,0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,
295     0x58,0x30,0x32,0x30,0x31,0xa4,0xce,0xca,0xd2,0xb2,
296     0xbe,0xcc,0xbe,0x20,0xa4,0xf2,0x20,0x45,0x53,0x43,
297     0x28,0x49,0xa4,0xc7,0xc9,0xe4,0xb9,0xe6,0xb2,0xbd,
298     0x0d,0x0a,0x20,0x20,0x6a,0x30,0x32,0x30,0x31,0x2d,
299     0x73,0x6f,0x2e,0x74,0x78,0x74,0x20,0x2d,0x20,0x4a,
300     0x49,0x53,0x20,0x58,0x30,0x32,0x30,0x31,0xa4,0xce,
301     0xca,0xd2,0xb2,0xbe,0xcc,0xbe,0x20,0xa4,0xf2,0x20,
302     0x53,0x4f,0x2f,0x53,0x49,0xa4,0xc7,0xc9,0xe4,0xb9,
303     0xe6,0xb2,0xbd,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x6a,
304     0x30,0x32,0x30,0x38,0x2d,0x38,0x62,0x2e,0x74,0x78,
305     0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,
306     0x32,0x30,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
307     0x20,0x20,0xa4,0xf2,0x20,0x38,0xc3,0xb1,0xb0,0xcc,
308     0xc9,0xe4,0xb9,0xe6,0xb2,0xbd,0x20,0x20,0x20,0x20,
309     0x20,0x20,0x20,0x45,0x55,0x43,0x2d,0x4a,0x50,0xa4,
310     0xc8,0xc6,0xb1,0xa4,0xb8,0x0d,0x0a,0x20,0x20,0x6a,
311     0x30,0x32,0x30,0x38,0x2d,0x37,0x38,0x2e,0x74,0x78,
312     0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,
313     0x32,0x30,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
314     0x20,0x20,0xa4,0xf2,0x20,0x45,0x53,0x43,0x24,0x40,
315     0xa4,0xc7,0xc9,0xe4,0xb9,0xe6,0xb2,0xbd,0x20,0x20,
316     0x20,0x20,0x20,0xa4,0xa4,0xa4,0xef,0xa4,0xe6,0xa4,
317     0xeb,0xb5,0xec,0x4a,0x49,0x53,0x0d,0x0a,0x20,0x20,
318     0x6a,0x30,0x32,0x30,0x38,0x2d,0x38,0x33,0x2e,0x74,
319     0x78,0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,
320     0x30,0x32,0x30,0x38,0x20,0x20,0x20,0x20,0x20,0x20,
321     0x20,0x20,0x20,0xa4,0xf2,0x20,0x45,0x53,0x43,0x24,
322     0x42,0xa4,0xc7,0xc9,0xe4,0xb9,0xe6,0xb2,0xbd,0x20,
323     0x20,0x20,0x20,0x20,0xa4,0xa4,0xa4,0xef,0xa4,0xe6,
324     0xa4,0xeb,0xbf,0xb7,0x4a,0x49,0x53,0x0d,0x0a,0x0d,
325     0x0a,0x20,0x20,0x65,0x30,0x32,0x30,0x31,0x2e,0x74,
326     0x78,0x74,0x20,0x2d,0x2d,0x2d,0x2d,0x20,0x4a,0x49,
327     0x53,0x20,0x58,0x30,0x32,0x30,0x31,0xa4,0xce,0xca,
328     0xd2,0xb2,0xbe,0xcc,0xbe,0x20,0xa4,0xf2,0x20,0x45,
329     0x55,0x43,0x2d,0x4a,0x50,0xa4,0xc7,0xc9,0xe4,0xb9,
330     0xe6,0xb2,0xbd,0x0d,0x0a,0x20,0x20,0x65,0x30,0x32,
331     0x30,0x38,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
332     0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,0x30,
333     0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
334     0xa4,0xf2,0x20,0x45,0x55,0x43,0x2d,0x4a,0x50,0xa4,
335     0xc7,0xc9,0xe4,0xb9,0xe6,0xb2,0xbd,0x20,0x20,0x20,
336     0x20,0x38,0xa5,0xd3,0xa5,0xc3,0xa5,0xc8,0x4a,0x49,
337     0x53,0x58,0x30,0x32,0x30,0x38,0xa4,0xc8,0xc6,0xb1,
338     0xa4,0xb8,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x73,0x30,
339     0x32,0x30,0x31,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,
340     0x2d,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,
341     0x30,0x31,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
342     0x20,0xa4,0xf2,0x20,0x53,0x68,0x69,0x66,0x74,0x5f,
343     0x4a,0x49,0x53,0xa4,0xc7,0xc9,0xe4,0xb9,0xe6,0xb2,
344     0xbd,0x20,0x38,0xa5,0xd3,0xa5,0xc3,0xa5,0xc8,0x4a,
345     0x49,0x53,0x58,0x30,0x32,0x30,0x31,0xa4,0xc8,0xc6,
346     0xb1,0xa4,0xb8,0x0d,0x0a,0x20,0x20,0x73,0x30,0x32,
347     0x30,0x38,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
348     0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,0x30,
349     0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
350     0xa4,0xf2,0x20,0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,
351     0x49,0x53,0xa4,0xc7,0xc9,0xe4,0xb9,0xe6,0xb2,0xbd,
352     0x0d,0x0a,0x0d,0x0a,0x6a,0x74,0x65,0x78,0x74,0x2f,
353     0x6f,0x74,0x68,0x65,0x72,0x73,0x2f,0x0d,0x0a,0x0d,
354     0x0a,0x20,0x20,0x62,0x36,0x34,0x6a,0x69,0x73,0x2e,
355     0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,0x20,0x49,0x53,
356     0x4f,0x2d,0x32,0x30,0x32,0x32,0x2d,0x4a,0x50,0x20,
357     0x28,0x4a,0x49,0x53,0x29,0x20,0xa4,0xf2,0x20,0x62,
358     0x61,0x73,0x65,0x36,0x34,0xa4,0xc7,0xc9,0xe4,0xb9,
359     0xe6,0xb2,0xbd,0x0d,0x0a,0x20,0x20,0x71,0x74,0x6a,
360     0x69,0x73,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
361     0x2d,0x20,0x49,0x53,0x4f,0x2d,0x32,0x30,0x32,0x32,
362     0x2d,0x4a,0x50,0x20,0x28,0x4a,0x49,0x53,0x29,0x20,
363     0xa4,0xf2,0x20,0x71,0x75,0x6f,0x74,0x65,0x64,0x2d,
364     0x70,0x72,0x69,0x6e,0x74,0x61,0x62,0x6c,0x65,0xa4,
365     0xc7,0xc9,0xe4,0xb9,0xe6,0xb2,0xbd,0x0d,0x0a,0x0d,
366     0x0a,0x20,0x20,0x62,0x6b,0x65,0x75,0x63,0x2e,0x74,
367     0x78,0x74,0x20,0x2d,0x2d,0x2d,0x2d,0x20,0xb2,0xf5,
368     0xa4,0xec,0xa4,0xbf,0x45,0x55,0x43,0x2d,0x4a,0x50,
369     0x20,0x20,0x20,0x20,0x20,0x20,0xc0,0xe8,0xc6,0xac,
370     0xa5,0xd3,0xa5,0xc3,0xa5,0xc8,0xa4,0xac,0xa5,0xbc,
371     0xa5,0xed,0x0d,0x0a,0x20,0x20,0x62,0x6b,0x6a,0x69,
372     0x73,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,0x2d,
373     0x20,0xb2,0xf5,0xa4,0xec,0xa4,0xbf,0x4a,0x49,0x53,
374     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x45,
375     0x53,0x43,0xa5,0xb3,0xa1,0xbc,0xa5,0xc9,0xa4,0xac,
376     0xb7,0xe7,0xa4,0xb1,0xa4,0xbf,0x0d,0x0a,0x20,0x20,
377     0x62,0x6b,0x73,0x6a,0x69,0x73,0x2e,0x74,0x78,0x74,
378     0x2d,0x2d,0x2d,0x2d,0x20,0xb2,0xf5,0xa4,0xec,0xa4,
379     0xbf,0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,0x49,0x53,
380     0x20,0x20,0x20,0xc0,0xe8,0xc6,0xac,0xa5,0xd3,0xa5,
381     0xc3,0xa5,0xc8,0xa4,0xac,0xa5,0xbc,0xa5,0xed,0x0d,
382     0x0a,0x0d,0x0a,0x20,0x20,0x63,0x74,0x72,0x6c,0x5f,
383     0x7a,0x2e,0x74,0x78,0x74,0x20,0x20,0x20,0x20,0x20,
384     0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,0x49,0x53,0x20,
385     0x20,0x20,0x20,0x20,0x20,0x5e,0x5a,0xa5,0xad,0xa5,
386     0xe3,0xa5,0xe9,0xa5,0xaf,0xa5,0xbf,0xc9,0xd5,0xa4,
387     0xad,0x20,0x20,0x20,0x28,0x44,0x4f,0x53,0xc9,0xf7,
388     0x29,0x0d,0x0a,0x20,0x20,0x6d,0x61,0x63,0x74,0x78,
389     0x74,0x2e,0x62,0x69,0x6e,0x20,0x20,0x20,0x20,0x20,
390     0xa5,0xde,0xa5,0xc3,0xa5,0xaf,0xa5,0xd0,0xa5,0xa4,
391     0xa5,0xca,0xa5,0xea,0x49,0x49,0xa5,0xd5,0xa5,0xa9,
392     0xa1,0xbc,0xa5,0xde,0xa5,0xc3,0xa5,0xc8,0x0d,0x0a
393 };
394 #endif /* #ifdef _ICONV_FROM_ENCODING_EUC_JP */
395 
396 #ifdef _ICONV_FROM_ENCODING_SHIFT_JIS
397 static const char shift_jis[] =
398 {
399     0x90,0x46,0x81,0x58,0x83,0x65,0x83,0x4c,0x83,0x58,
400     0x83,0x67,0x83,0x74,0x83,0x40,0x83,0x43,0x83,0x8b,
401     0x8f,0x57,0x20,0x56,0x65,0x72,0x33,0x2e,0x33,0x20,
402     0x28,0x43,0x29,0x48,0x41,0x54,0x0d,0x0a,0x0d,0x0a,
403     0x82,0xb1,0x82,0xcc,0x83,0x41,0x81,0x5b,0x83,0x4a,
404     0x83,0x43,0x83,0x75,0x82,0xcc,0x8d,0xc5,0x90,0x56,
405     0x94,0xc5,0x82,0xcd,0x82,0xb1,0x82,0xb1,0x82,0xc9,
406     0x82,0xa0,0x82,0xe8,0x82,0xdc,0x82,0xb7,0x81,0x42,
407     0x0d,0x0a,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,
408     0x77,0x77,0x30,0x32,0x2e,0x73,0x6f,0x2d,0x6e,0x65,
409     0x74,0x2e,0x6e,0x65,0x2e,0x6a,0x70,0x2f,0x25,0x37,
410     0x45,0x68,0x61,0x74,0x2f,0x66,0x69,0x6c,0x65,0x73,
411     0x2f,0x69,0x6e,0x64,0x65,0x78,0x2d,0x6a,0x2e,0x68,
412     0x74,0x6d,0x6c,0x0d,0x0a,0x0d,0x0a,0x63,0x72,0x2c,
413     0x20,0x63,0x72,0x6c,0x66,0x2c,0x20,0x6c,0x66,0x83,
414     0x66,0x83,0x42,0x83,0x8c,0x83,0x4e,0x83,0x67,0x83,
415     0x8a,0x28,0x83,0x74,0x83,0x48,0x83,0x8b,0x83,0x5f,
416     0x29,0x82,0xcc,0x93,0xe0,0x97,0x65,0x82,0xcd,0x93,
417     0xaf,0x82,0xb6,0x82,0xc5,0x82,0xb7,0x82,0xaa,0x81,
418     0x41,0x8d,0x73,0x82,0xcc,0x8b,0xe6,0x90,0xd8,0x82,
419     0xe8,0x82,0xaa,0x82,0xbb,0x82,0xea,0x82,0xbc,0x82,
420     0xea,0x0d,0x0a,0x43,0x52,0x28,0x4d,0x61,0x63,0x95,
421     0x97,0x29,0x81,0x41,0x43,0x52,0x2b,0x4c,0x46,0x28,
422     0x44,0x4f,0x53,0x95,0x97,0x29,0x81,0x41,0x4c,0x46,
423     0x28,0x55,0x4e,0x49,0x58,0x95,0x97,0x29,0x82,0xc9,
424     0x82,0xc8,0x82,0xc1,0x82,0xc4,0x82,0xa2,0x82,0xdc,
425     0x82,0xb7,0x81,0x42,0x0d,0x0a,0x0d,0x0a,0x0d,0x0a,
426     0x6a,0x74,0x65,0x78,0x74,0x2f,0x0d,0x0a,0x0d,0x0a,
427     0x20,0x20,0x72,0x65,0x61,0x64,0x6d,0x65,0x2e,0x74,
428     0x78,0x74,0x20,0x2d,0x2d,0x2d,0x20,0x89,0x70,0x8c,
429     0xea,0x52,0x45,0x41,0x44,0x4d,0x45,0x20,0x20,0x20,
430     0x20,0x20,0x28,0x41,0x53,0x43,0x49,0x49,0x29,0x0d,
431     0x0a,0x20,0x20,0x72,0x65,0x61,0x64,0x6d,0x65,0x2e,
432     0x65,0x75,0x63,0x20,0x2d,0x2d,0x2d,0x20,0x82,0xb1,
433     0x82,0xcc,0x83,0x74,0x83,0x40,0x83,0x43,0x83,0x8b,
434     0x20,0x20,0x20,0x28,0x45,0x55,0x43,0x2d,0x4a,0x50,
435     0x29,0x0d,0x0a,0x20,0x20,0x72,0x65,0x61,0x64,0x6d,
436     0x65,0x2e,0x6a,0x69,0x73,0x20,0x2d,0x2d,0x2d,0x20,
437     0x93,0xfa,0x96,0x7b,0x8c,0xea,0x52,0x45,0x41,0x44,
438     0x4d,0x45,0x20,0x20,0x20,0x28,0x4a,0x49,0x53,0x29,
439     0x0d,0x0a,0x20,0x20,0x72,0x65,0x61,0x64,0x6d,0x65,
440     0x2e,0x73,0x6a,0x73,0x20,0x2d,0x2d,0x2d,0x20,0x93,
441     0xfa,0x96,0x7b,0x8c,0xea,0x52,0x45,0x41,0x44,0x4d,
442     0x45,0x20,0x20,0x20,0x28,0x53,0x68,0x69,0x66,0x74,
443     0x5f,0x4a,0x49,0x53,0x29,0x0d,0x0a,0x0d,0x0a,0x6a,
444     0x74,0x65,0x78,0x74,0x2f,0x63,0x72,0x2f,0x0d,0x0a,
445     0x6a,0x74,0x65,0x78,0x74,0x2f,0x63,0x72,0x6c,0x66,
446     0x2f,0x0d,0x0a,0x6a,0x74,0x65,0x78,0x74,0x2f,0x6c,
447     0x66,0x2f,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x61,0x73,
448     0x63,0x69,0x69,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,
449     0x2d,0x2d,0x20,0x41,0x53,0x43,0x49,0x49,0x82,0xc5,
450     0x8f,0x91,0x82,0xa2,0x82,0xbd,0x93,0xfa,0x96,0x7b,
451     0x8c,0xea,0x28,0x83,0x8d,0x81,0x5b,0x83,0x7d,0x8e,
452     0x9a,0x29,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x6a,0x30,
453     0x32,0x30,0x31,0x2d,0x38,0x62,0x2e,0x74,0x78,0x74,
454     0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,
455     0x30,0x31,0x82,0xcc,0x95,0xd0,0x89,0xbc,0x96,0xbc,
456     0x20,0x82,0xf0,0x20,0x38,0x92,0x50,0x88,0xca,0x95,
457     0x84,0x8d,0x86,0x89,0xbb,0x20,0x20,0x20,0x20,0x20,
458     0x20,0x20,0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,0x49,
459     0x53,0x82,0xc6,0x93,0xaf,0x82,0xb6,0x0d,0x0a,0x20,
460     0x20,0x6a,0x30,0x32,0x30,0x31,0x2d,0x65,0x73,0x2e,
461     0x74,0x78,0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,
462     0x58,0x30,0x32,0x30,0x31,0x82,0xcc,0x95,0xd0,0x89,
463     0xbc,0x96,0xbc,0x20,0x82,0xf0,0x20,0x45,0x53,0x43,
464     0x28,0x49,0x82,0xc5,0x95,0x84,0x8d,0x86,0x89,0xbb,
465     0x0d,0x0a,0x20,0x20,0x6a,0x30,0x32,0x30,0x31,0x2d,
466     0x73,0x6f,0x2e,0x74,0x78,0x74,0x20,0x2d,0x20,0x4a,
467     0x49,0x53,0x20,0x58,0x30,0x32,0x30,0x31,0x82,0xcc,
468     0x95,0xd0,0x89,0xbc,0x96,0xbc,0x20,0x82,0xf0,0x20,
469     0x53,0x4f,0x2f,0x53,0x49,0x82,0xc5,0x95,0x84,0x8d,
470     0x86,0x89,0xbb,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x6a,
471     0x30,0x32,0x30,0x38,0x2d,0x38,0x62,0x2e,0x74,0x78,
472     0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,
473     0x32,0x30,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
474     0x20,0x20,0x82,0xf0,0x20,0x38,0x92,0x50,0x88,0xca,
475     0x95,0x84,0x8d,0x86,0x89,0xbb,0x20,0x20,0x20,0x20,
476     0x20,0x20,0x20,0x45,0x55,0x43,0x2d,0x4a,0x50,0x82,
477     0xc6,0x93,0xaf,0x82,0xb6,0x0d,0x0a,0x20,0x20,0x6a,
478     0x30,0x32,0x30,0x38,0x2d,0x37,0x38,0x2e,0x74,0x78,
479     0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,
480     0x32,0x30,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
481     0x20,0x20,0x82,0xf0,0x20,0x45,0x53,0x43,0x24,0x40,
482     0x82,0xc5,0x95,0x84,0x8d,0x86,0x89,0xbb,0x20,0x20,
483     0x20,0x20,0x20,0x82,0xa2,0x82,0xed,0x82,0xe4,0x82,
484     0xe9,0x8b,0x8c,0x4a,0x49,0x53,0x0d,0x0a,0x20,0x20,
485     0x6a,0x30,0x32,0x30,0x38,0x2d,0x38,0x33,0x2e,0x74,
486     0x78,0x74,0x20,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,
487     0x30,0x32,0x30,0x38,0x20,0x20,0x20,0x20,0x20,0x20,
488     0x20,0x20,0x20,0x82,0xf0,0x20,0x45,0x53,0x43,0x24,
489     0x42,0x82,0xc5,0x95,0x84,0x8d,0x86,0x89,0xbb,0x20,
490     0x20,0x20,0x20,0x20,0x82,0xa2,0x82,0xed,0x82,0xe4,
491     0x82,0xe9,0x90,0x56,0x4a,0x49,0x53,0x0d,0x0a,0x0d,
492     0x0a,0x20,0x20,0x65,0x30,0x32,0x30,0x31,0x2e,0x74,
493     0x78,0x74,0x20,0x2d,0x2d,0x2d,0x2d,0x20,0x4a,0x49,
494     0x53,0x20,0x58,0x30,0x32,0x30,0x31,0x82,0xcc,0x95,
495     0xd0,0x89,0xbc,0x96,0xbc,0x20,0x82,0xf0,0x20,0x45,
496     0x55,0x43,0x2d,0x4a,0x50,0x82,0xc5,0x95,0x84,0x8d,
497     0x86,0x89,0xbb,0x0d,0x0a,0x20,0x20,0x65,0x30,0x32,
498     0x30,0x38,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
499     0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,0x30,
500     0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
501     0x82,0xf0,0x20,0x45,0x55,0x43,0x2d,0x4a,0x50,0x82,
502     0xc5,0x95,0x84,0x8d,0x86,0x89,0xbb,0x20,0x20,0x20,
503     0x20,0x38,0x83,0x72,0x83,0x62,0x83,0x67,0x4a,0x49,
504     0x53,0x58,0x30,0x32,0x30,0x38,0x82,0xc6,0x93,0xaf,
505     0x82,0xb6,0x0d,0x0a,0x0d,0x0a,0x20,0x20,0x73,0x30,
506     0x32,0x30,0x31,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,
507     0x2d,0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,
508     0x30,0x31,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
509     0x20,0x82,0xf0,0x20,0x53,0x68,0x69,0x66,0x74,0x5f,
510     0x4a,0x49,0x53,0x82,0xc5,0x95,0x84,0x8d,0x86,0x89,
511     0xbb,0x20,0x38,0x83,0x72,0x83,0x62,0x83,0x67,0x4a,
512     0x49,0x53,0x58,0x30,0x32,0x30,0x31,0x82,0xc6,0x93,
513     0xaf,0x82,0xb6,0x0d,0x0a,0x20,0x20,0x73,0x30,0x32,
514     0x30,0x38,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
515     0x2d,0x20,0x4a,0x49,0x53,0x20,0x58,0x30,0x32,0x30,
516     0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
517     0x82,0xf0,0x20,0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,
518     0x49,0x53,0x82,0xc5,0x95,0x84,0x8d,0x86,0x89,0xbb,
519     0x0d,0x0a,0x0d,0x0a,0x6a,0x74,0x65,0x78,0x74,0x2f,
520     0x6f,0x74,0x68,0x65,0x72,0x73,0x2f,0x0d,0x0a,0x0d,
521     0x0a,0x20,0x20,0x62,0x36,0x34,0x6a,0x69,0x73,0x2e,
522     0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,0x20,0x49,0x53,
523     0x4f,0x2d,0x32,0x30,0x32,0x32,0x2d,0x4a,0x50,0x20,
524     0x28,0x4a,0x49,0x53,0x29,0x20,0x82,0xf0,0x20,0x62,
525     0x61,0x73,0x65,0x36,0x34,0x82,0xc5,0x95,0x84,0x8d,
526     0x86,0x89,0xbb,0x0d,0x0a,0x20,0x20,0x71,0x74,0x6a,
527     0x69,0x73,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,
528     0x2d,0x20,0x49,0x53,0x4f,0x2d,0x32,0x30,0x32,0x32,
529     0x2d,0x4a,0x50,0x20,0x28,0x4a,0x49,0x53,0x29,0x20,
530     0x82,0xf0,0x20,0x71,0x75,0x6f,0x74,0x65,0x64,0x2d,
531     0x70,0x72,0x69,0x6e,0x74,0x61,0x62,0x6c,0x65,0x82,
532     0xc5,0x95,0x84,0x8d,0x86,0x89,0xbb,0x0d,0x0a,0x0d,
533     0x0a,0x20,0x20,0x62,0x6b,0x65,0x75,0x63,0x2e,0x74,
534     0x78,0x74,0x20,0x2d,0x2d,0x2d,0x2d,0x20,0x89,0xf3,
535     0x82,0xea,0x82,0xbd,0x45,0x55,0x43,0x2d,0x4a,0x50,
536     0x20,0x20,0x20,0x20,0x20,0x20,0x90,0xe6,0x93,0xaa,
537     0x83,0x72,0x83,0x62,0x83,0x67,0x82,0xaa,0x83,0x5b,
538     0x83,0x8d,0x0d,0x0a,0x20,0x20,0x62,0x6b,0x6a,0x69,
539     0x73,0x2e,0x74,0x78,0x74,0x20,0x2d,0x2d,0x2d,0x2d,
540     0x20,0x89,0xf3,0x82,0xea,0x82,0xbd,0x4a,0x49,0x53,
541     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x45,
542     0x53,0x43,0x83,0x52,0x81,0x5b,0x83,0x68,0x82,0xaa,
543     0x8c,0x87,0x82,0xaf,0x82,0xbd,0x0d,0x0a,0x20,0x20,
544     0x62,0x6b,0x73,0x6a,0x69,0x73,0x2e,0x74,0x78,0x74,
545     0x2d,0x2d,0x2d,0x2d,0x20,0x89,0xf3,0x82,0xea,0x82,
546     0xbd,0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,0x49,0x53,
547     0x20,0x20,0x20,0x90,0xe6,0x93,0xaa,0x83,0x72,0x83,
548     0x62,0x83,0x67,0x82,0xaa,0x83,0x5b,0x83,0x8d,0x0d,
549     0x0a,0x0d,0x0a,0x20,0x20,0x63,0x74,0x72,0x6c,0x5f,
550     0x7a,0x2e,0x74,0x78,0x74,0x20,0x20,0x20,0x20,0x20,
551     0x53,0x68,0x69,0x66,0x74,0x5f,0x4a,0x49,0x53,0x20,
552     0x20,0x20,0x20,0x20,0x20,0x5e,0x5a,0x83,0x4c,0x83,
553     0x83,0x83,0x89,0x83,0x4e,0x83,0x5e,0x95,0x74,0x82,
554     0xab,0x20,0x20,0x20,0x28,0x44,0x4f,0x53,0x95,0x97,
555     0x29,0x0d,0x0a,0x20,0x20,0x6d,0x61,0x63,0x74,0x78,
556     0x74,0x2e,0x62,0x69,0x6e,0x20,0x20,0x20,0x20,0x20,
557     0x83,0x7d,0x83,0x62,0x83,0x4e,0x83,0x6f,0x83,0x43,
558     0x83,0x69,0x83,0x8a,0x49,0x49,0x83,0x74,0x83,0x48,
559     0x81,0x5b,0x83,0x7d,0x83,0x62,0x83,0x67,0x0d,0x0a
560 };
561 #endif /* _ICONV_FROM_ENCODING_SHIFT_JIS */
562 
563 #ifdef _ICONV_FROM_ENCODING_UCS_2_INTERNAL
564 static const short ucs2[] =
565 {
566     0x8272,0x3005,0x30c6,0x30ad,0x30b9,
567     0x30c8,0x30d5,0x30a1,0x30a4,0x30eb,
568     0x96c6,0x0020,0x0056,0x0065,0x0072,
569     0x0033,0x002e,0x0033,0x0020,0x0028,
570     0x0043,0x0029,0x0048,0x0041,0x0054,
571     0x000d,0x000a,0x000d,0x000a,0x3053,
572     0x306e,0x30a2,0x30fc,0x30ab,0x30a4,
573     0x30d6,0x306e,0x6700,0x65b0,0x7248,
574     0x306f,0x3053,0x3053,0x306b,0x3042,
575     0x308a,0x307e,0x3059,0x3002,0x000d,
576     0x000a,0x0068,0x0074,0x0074,0x0070,
577     0x003a,0x002f,0x002f,0x0077,0x0077,
578     0x0077,0x0030,0x0032,0x002e,0x0073,
579     0x006f,0x002d,0x006e,0x0065,0x0074,
580     0x002e,0x006e,0x0065,0x002e,0x006a,
581     0x0070,0x002f,0x0025,0x0037,0x0045,
582     0x0068,0x0061,0x0074,0x002f,0x0066,
583     0x0069,0x006c,0x0065,0x0073,0x002f,
584     0x0069,0x006e,0x0064,0x0065,0x0078,
585     0x002d,0x006a,0x002e,0x0068,0x0074,
586     0x006d,0x006c,0x000d,0x000a,0x000d,
587     0x000a,0x0063,0x0072,0x002c,0x0020,
588     0x0063,0x0072,0x006c,0x0066,0x002c,
589     0x0020,0x006c,0x0066,0x30c7,0x30a3,
590     0x30ec,0x30af,0x30c8,0x30ea,0x0028,
591     0x30d5,0x30a9,0x30eb,0x30c0,0x0029,
592     0x306e,0x5185,0x5bb9,0x306f,0x540c,
593     0x3058,0x3067,0x3059,0x304c,0x3001,
594     0x884c,0x306e,0x533a,0x5207,0x308a,
595     0x304c,0x305d,0x308c,0x305e,0x308c,
596     0x000d,0x000a,0x0043,0x0052,0x0028,
597     0x004d,0x0061,0x0063,0x98a8,0x0029,
598     0x3001,0x0043,0x0052,0x002b,0x004c,
599     0x0046,0x0028,0x0044,0x004f,0x0053,
600     0x98a8,0x0029,0x3001,0x004c,0x0046,
601     0x0028,0x0055,0x004e,0x0049,0x0058,
602     0x98a8,0x0029,0x306b,0x306a,0x3063,
603     0x3066,0x3044,0x307e,0x3059,0x3002,
604     0x000d,0x000a,0x000d,0x000a,0x000d,
605     0x000a,0x006a,0x0074,0x0065,0x0078,
606     0x0074,0x002f,0x000d,0x000a,0x000d,
607     0x000a,0x0020,0x0020,0x0072,0x0065,
608     0x0061,0x0064,0x006d,0x0065,0x002e,
609     0x0074,0x0078,0x0074,0x0020,0x002d,
610     0x002d,0x002d,0x0020,0x82f1,0x8a9e,
611     0x0052,0x0045,0x0041,0x0044,0x004d,
612     0x0045,0x0020,0x0020,0x0020,0x0020,
613     0x0020,0x0028,0x0041,0x0053,0x0043,
614     0x0049,0x0049,0x0029,0x000d,0x000a,
615     0x0020,0x0020,0x0072,0x0065,0x0061,
616     0x0064,0x006d,0x0065,0x002e,0x0065,
617     0x0075,0x0063,0x0020,0x002d,0x002d,
618     0x002d,0x0020,0x3053,0x306e,0x30d5,
619     0x30a1,0x30a4,0x30eb,0x0020,0x0020,
620     0x0020,0x0028,0x0045,0x0055,0x0043,
621     0x002d,0x004a,0x0050,0x0029,0x000d,
622     0x000a,0x0020,0x0020,0x0072,0x0065,
623     0x0061,0x0064,0x006d,0x0065,0x002e,
624     0x006a,0x0069,0x0073,0x0020,0x002d,
625     0x002d,0x002d,0x0020,0x65e5,0x672c,
626     0x8a9e,0x0052,0x0045,0x0041,0x0044,
627     0x004d,0x0045,0x0020,0x0020,0x0020,
628     0x0028,0x004a,0x0049,0x0053,0x0029,
629     0x000d,0x000a,0x0020,0x0020,0x0072,
630     0x0065,0x0061,0x0064,0x006d,0x0065,
631     0x002e,0x0073,0x006a,0x0073,0x0020,
632     0x002d,0x002d,0x002d,0x0020,0x65e5,
633     0x672c,0x8a9e,0x0052,0x0045,0x0041,
634     0x0044,0x004d,0x0045,0x0020,0x0020,
635     0x0020,0x0028,0x0053,0x0068,0x0069,
636     0x0066,0x0074,0x005f,0x004a,0x0049,
637     0x0053,0x0029,0x000d,0x000a,0x000d,
638     0x000a,0x006a,0x0074,0x0065,0x0078,
639     0x0074,0x002f,0x0063,0x0072,0x002f,
640     0x000d,0x000a,0x006a,0x0074,0x0065,
641     0x0078,0x0074,0x002f,0x0063,0x0072,
642     0x006c,0x0066,0x002f,0x000d,0x000a,
643     0x006a,0x0074,0x0065,0x0078,0x0074,
644     0x002f,0x006c,0x0066,0x002f,0x000d,
645     0x000a,0x000d,0x000a,0x0020,0x0020,
646     0x0061,0x0073,0x0063,0x0069,0x0069,
647     0x002e,0x0074,0x0078,0x0074,0x0020,
648     0x002d,0x002d,0x002d,0x002d,0x0020,
649     0x0041,0x0053,0x0043,0x0049,0x0049,
650     0x3067,0x66f8,0x3044,0x305f,0x65e5,
651     0x672c,0x8a9e,0x0028,0x30ed,0x30fc,
652     0x30de,0x5b57,0x0029,0x000d,0x000a,
653     0x000d,0x000a,0x0020,0x0020,0x006a,
654     0x0030,0x0032,0x0030,0x0031,0x002d,
655     0x0038,0x0062,0x002e,0x0074,0x0078,
656     0x0074,0x0020,0x002d,0x0020,0x004a,
657     0x0049,0x0053,0x0020,0x0058,0x0030,
658     0x0032,0x0030,0x0031,0x306e,0x7247,
659     0x4eee,0x540d,0x0020,0x3092,0x0020,
660     0x0038,0x5358,0x4f4d,0x7b26,0x53f7,
661     0x5316,0x0020,0x0020,0x0020,0x0020,
662     0x0020,0x0020,0x0020,0x0053,0x0068,
663     0x0069,0x0066,0x0074,0x005f,0x004a,
664     0x0049,0x0053,0x3068,0x540c,0x3058,
665     0x000d,0x000a,0x0020,0x0020,0x006a,
666     0x0030,0x0032,0x0030,0x0031,0x002d,
667     0x0065,0x0073,0x002e,0x0074,0x0078,
668     0x0074,0x0020,0x002d,0x0020,0x004a,
669     0x0049,0x0053,0x0020,0x0058,0x0030,
670     0x0032,0x0030,0x0031,0x306e,0x7247,
671     0x4eee,0x540d,0x0020,0x3092,0x0020,
672     0x0045,0x0053,0x0043,0x0028,0x0049,
673     0x3067,0x7b26,0x53f7,0x5316,0x000d,
674     0x000a,0x0020,0x0020,0x006a,0x0030,
675     0x0032,0x0030,0x0031,0x002d,0x0073,
676     0x006f,0x002e,0x0074,0x0078,0x0074,
677     0x0020,0x002d,0x0020,0x004a,0x0049,
678     0x0053,0x0020,0x0058,0x0030,0x0032,
679     0x0030,0x0031,0x306e,0x7247,0x4eee,
680     0x540d,0x0020,0x3092,0x0020,0x0053,
681     0x004f,0x002f,0x0053,0x0049,0x3067,
682     0x7b26,0x53f7,0x5316,0x000d,0x000a,
683     0x000d,0x000a,0x0020,0x0020,0x006a,
684     0x0030,0x0032,0x0030,0x0038,0x002d,
685     0x0038,0x0062,0x002e,0x0074,0x0078,
686     0x0074,0x0020,0x002d,0x0020,0x004a,
687     0x0049,0x0053,0x0020,0x0058,0x0030,
688     0x0032,0x0030,0x0038,0x0020,0x0020,
689     0x0020,0x0020,0x0020,0x0020,0x0020,
690     0x0020,0x0020,0x3092,0x0020,0x0038,
691     0x5358,0x4f4d,0x7b26,0x53f7,0x5316,
692     0x0020,0x0020,0x0020,0x0020,0x0020,
693     0x0020,0x0020,0x0045,0x0055,0x0043,
694     0x002d,0x004a,0x0050,0x3068,0x540c,
695     0x3058,0x000d,0x000a,0x0020,0x0020,
696     0x006a,0x0030,0x0032,0x0030,0x0038,
697     0x002d,0x0037,0x0038,0x002e,0x0074,
698     0x0078,0x0074,0x0020,0x002d,0x0020,
699     0x004a,0x0049,0x0053,0x0020,0x0058,
700     0x0030,0x0032,0x0030,0x0038,0x0020,
701     0x0020,0x0020,0x0020,0x0020,0x0020,
702     0x0020,0x0020,0x0020,0x3092,0x0020,
703     0x0045,0x0053,0x0043,0x0024,0x0040,
704     0x3067,0x7b26,0x53f7,0x5316,0x0020,
705     0x0020,0x0020,0x0020,0x0020,0x3044,
706     0x308f,0x3086,0x308b,0x65e7,0x004a,
707     0x0049,0x0053,0x000d,0x000a,0x0020,
708     0x0020,0x006a,0x0030,0x0032,0x0030,
709     0x0038,0x002d,0x0038,0x0033,0x002e,
710     0x0074,0x0078,0x0074,0x0020,0x002d,
711     0x0020,0x004a,0x0049,0x0053,0x0020,
712     0x0058,0x0030,0x0032,0x0030,0x0038,
713     0x0020,0x0020,0x0020,0x0020,0x0020,
714     0x0020,0x0020,0x0020,0x0020,0x3092,
715     0x0020,0x0045,0x0053,0x0043,0x0024,
716     0x0042,0x3067,0x7b26,0x53f7,0x5316,
717     0x0020,0x0020,0x0020,0x0020,0x0020,
718     0x3044,0x308f,0x3086,0x308b,0x65b0,
719     0x004a,0x0049,0x0053,0x000d,0x000a,
720     0x000d,0x000a,0x0020,0x0020,0x0065,
721     0x0030,0x0032,0x0030,0x0031,0x002e,
722     0x0074,0x0078,0x0074,0x0020,0x002d,
723     0x002d,0x002d,0x002d,0x0020,0x004a,
724     0x0049,0x0053,0x0020,0x0058,0x0030,
725     0x0032,0x0030,0x0031,0x306e,0x7247,
726     0x4eee,0x540d,0x0020,0x3092,0x0020,
727     0x0045,0x0055,0x0043,0x002d,0x004a,
728     0x0050,0x3067,0x7b26,0x53f7,0x5316,
729     0x000d,0x000a,0x0020,0x0020,0x0065,
730     0x0030,0x0032,0x0030,0x0038,0x002e,
731     0x0074,0x0078,0x0074,0x0020,0x002d,
732     0x002d,0x002d,0x002d,0x0020,0x004a,
733     0x0049,0x0053,0x0020,0x0058,0x0030,
734     0x0032,0x0030,0x0038,0x0020,0x0020,
735     0x0020,0x0020,0x0020,0x0020,0x0020,
736     0x0020,0x0020,0x3092,0x0020,0x0045,
737     0x0055,0x0043,0x002d,0x004a,0x0050,
738     0x3067,0x7b26,0x53f7,0x5316,0x0020,
739     0x0020,0x0020,0x0020,0x0038,0x30d3,
740     0x30c3,0x30c8,0x004a,0x0049,0x0053,
741     0x0058,0x0030,0x0032,0x0030,0x0038,
742     0x3068,0x540c,0x3058,0x000d,0x000a,
743     0x000d,0x000a,0x0020,0x0020,0x0073,
744     0x0030,0x0032,0x0030,0x0031,0x002e,
745     0x0074,0x0078,0x0074,0x0020,0x002d,
746     0x002d,0x002d,0x002d,0x0020,0x004a,
747     0x0049,0x0053,0x0020,0x0058,0x0030,
748     0x0032,0x0030,0x0031,0x0020,0x0020,
749     0x0020,0x0020,0x0020,0x0020,0x0020,
750     0x0020,0x0020,0x3092,0x0020,0x0053,
751     0x0068,0x0069,0x0066,0x0074,0x005f,
752     0x004a,0x0049,0x0053,0x3067,0x7b26,
753     0x53f7,0x5316,0x0020,0x0038,0x30d3,
754     0x30c3,0x30c8,0x004a,0x0049,0x0053,
755     0x0058,0x0030,0x0032,0x0030,0x0031,
756     0x3068,0x540c,0x3058,0x000d,0x000a,
757     0x0020,0x0020,0x0073,0x0030,0x0032,
758     0x0030,0x0038,0x002e,0x0074,0x0078,
759     0x0074,0x0020,0x002d,0x002d,0x002d,
760     0x002d,0x0020,0x004a,0x0049,0x0053,
761     0x0020,0x0058,0x0030,0x0032,0x0030,
762     0x0038,0x0020,0x0020,0x0020,0x0020,
763     0x0020,0x0020,0x0020,0x0020,0x0020,
764     0x3092,0x0020,0x0053,0x0068,0x0069,
765     0x0066,0x0074,0x005f,0x004a,0x0049,
766     0x0053,0x3067,0x7b26,0x53f7,0x5316,
767     0x000d,0x000a,0x000d,0x000a,0x006a,
768     0x0074,0x0065,0x0078,0x0074,0x002f,
769     0x006f,0x0074,0x0068,0x0065,0x0072,
770     0x0073,0x002f,0x000d,0x000a,0x000d,
771     0x000a,0x0020,0x0020,0x0062,0x0036,
772     0x0034,0x006a,0x0069,0x0073,0x002e,
773     0x0074,0x0078,0x0074,0x0020,0x002d,
774     0x002d,0x002d,0x0020,0x0049,0x0053,
775     0x004f,0x002d,0x0032,0x0030,0x0032,
776     0x0032,0x002d,0x004a,0x0050,0x0020,
777     0x0028,0x004a,0x0049,0x0053,0x0029,
778     0x0020,0x3092,0x0020,0x0062,0x0061,
779     0x0073,0x0065,0x0036,0x0034,0x3067,
780     0x7b26,0x53f7,0x5316,0x000d,0x000a,
781     0x0020,0x0020,0x0071,0x0074,0x006a,
782     0x0069,0x0073,0x002e,0x0074,0x0078,
783     0x0074,0x0020,0x002d,0x002d,0x002d,
784     0x002d,0x0020,0x0049,0x0053,0x004f,
785     0x002d,0x0032,0x0030,0x0032,0x0032,
786     0x002d,0x004a,0x0050,0x0020,0x0028,
787     0x004a,0x0049,0x0053,0x0029,0x0020,
788     0x3092,0x0020,0x0071,0x0075,0x006f,
789     0x0074,0x0065,0x0064,0x002d,0x0070,
790     0x0072,0x0069,0x006e,0x0074,0x0061,
791     0x0062,0x006c,0x0065,0x3067,0x7b26,
792     0x53f7,0x5316,0x000d,0x000a,0x000d,
793     0x000a,0x0020,0x0020,0x0062,0x006b,
794     0x0065,0x0075,0x0063,0x002e,0x0074,
795     0x0078,0x0074,0x0020,0x002d,0x002d,
796     0x002d,0x002d,0x0020,0x58ca,0x308c,
797     0x305f,0x0045,0x0055,0x0043,0x002d,
798     0x004a,0x0050,0x0020,0x0020,0x0020,
799     0x0020,0x0020,0x0020,0x5148,0x982d,
800     0x30d3,0x30c3,0x30c8,0x304c,0x30bc,
801     0x30ed,0x000d,0x000a,0x0020,0x0020,
802     0x0062,0x006b,0x006a,0x0069,0x0073,
803     0x002e,0x0074,0x0078,0x0074,0x0020,
804     0x002d,0x002d,0x002d,0x002d,0x0020,
805     0x58ca,0x308c,0x305f,0x004a,0x0049,
806     0x0053,0x0020,0x0020,0x0020,0x0020,
807     0x0020,0x0020,0x0020,0x0020,0x0020,
808     0x0045,0x0053,0x0043,0x30b3,0x30fc,
809     0x30c9,0x304c,0x6b20,0x3051,0x305f,
810     0x000d,0x000a,0x0020,0x0020,0x0062,
811     0x006b,0x0073,0x006a,0x0069,0x0073,
812     0x002e,0x0074,0x0078,0x0074,0x002d,
813     0x002d,0x002d,0x002d,0x0020,0x58ca,
814     0x308c,0x305f,0x0053,0x0068,0x0069,
815     0x0066,0x0074,0x005f,0x004a,0x0049,
816     0x0053,0x0020,0x0020,0x0020,0x5148,
817     0x982d,0x30d3,0x30c3,0x30c8,0x304c,
818     0x30bc,0x30ed,0x000d,0x000a,0x000d,
819     0x000a,0x0020,0x0020,0x0063,0x0074,
820     0x0072,0x006c,0x005f,0x007a,0x002e,
821     0x0074,0x0078,0x0074,0x0020,0x0020,
822     0x0020,0x0020,0x0020,0x0053,0x0068,
823     0x0069,0x0066,0x0074,0x005f,0x004a,
824     0x0049,0x0053,0x0020,0x0020,0x0020,
825     0x0020,0x0020,0x0020,0x005e,0x005a,
826     0x30ad,0x30e3,0x30e9,0x30af,0x30bf,
827     0x4ed8,0x304d,0x0020,0x0020,0x0020,
828     0x0028,0x0044,0x004f,0x0053,0x98a8,
829     0x0029,0x000d,0x000a,0x0020,0x0020,
830     0x006d,0x0061,0x0063,0x0074,0x0078,
831     0x0074,0x002e,0x0062,0x0069,0x006e,
832     0x0020,0x0020,0x0020,0x0020,0x0020,
833     0x30de,0x30c3,0x30af,0x30d0,0x30a4,
834     0x30ca,0x30ea,0x0049,0x0049,0x30d5,
835     0x30a9,0x30fc,0x30de,0x30c3,0x30c8,
836     0x000d,0x000a
837 };
838 #endif
839 
840 struct iconv_data
841 {
842     size_t len;
843     char *name;
844     char *data;
845 };
846 
847 #define CONVERSIONS 4
848 
849 static const struct iconv_data data[] =
850 {
851 #if defined(_ICONV_FROM_ENCODING_EUC_JP) && defined(_ICONV_TO_ENCODING_EUC_JP)
852     {sizeof(euc_jp), "EUC-JP", (char *)euc_jp},
853 #endif
854 #if defined(_ICONV_FROM_ENCODING_SHIFT_JIS) && defined(_ICONV_TO_ENCODING_SHIFT_JIS)
855     {sizeof(shift_jis), "SHIFT-JIS", (char *)shift_jis},
856 #endif
857 #if defined(_ICONV_FROM_ENCODING_UTF_8) && defined(_ICONV_TO_ENCODING_UTF_8)
858     {sizeof(utf8), "UTF-8", (char *)utf8},
859 #endif
860 #if defined(_ICONV_FROM_ENCODING_UCS_2_INTERNAL) && defined(_ICONV_TO_ENCODING_UCS_2_INTERNAL)
861     {sizeof(ucs2), "UCS-2-INTERNAL", (char *)ucs2},
862 #endif
863     {0, NULL, NULL}
864 };
865 
866 #define OUTBUF_LEN 2800
867 char ob[OUTBUF_LEN];
868 
869 iconv_t descs[CONVERSIONS*CONVERSIONS];
870 
871 #define ERROR 0
872 
873 #ifndef TEST_NLSPATH
874 #define TEST_NLSPATH "./"
875 #endif
876 
main(void)877 int main(void)
878 {
879     int i, j, d = 0;
880     unsigned k;
881     size_t n;
882     char *outbuf, *inbuf;
883     int conversions = sizeof(data)/sizeof(struct iconv_data) - 1;
884 
885     CHECK(setenv("NLSPATH", TEST_NLSPATH, 0) != -1);
886 
887     puts("JP iconv test");
888 
889     for (i = 0; i < conversions; i++)
890     {
891         for (j = 0; j < conversions; j++)
892 	{
893 	    descs[d] = iconv_open(data[j].name, data[i].name);
894 	    if (descs[d++] == (iconv_t)-1)
895 	    {
896 	        printf("iconv_open(%s, %s)\n", data[i].name, data[j].name);
897 	        perror("");
898                 CHECK(ERROR);
899 	    }
900 	}
901     }
902 
903     d = 0;
904     for (i = 0; i < conversions; i++)
905     {
906         for (j = 0; j < conversions; j++)
907 	{
908 	    size_t inbytes = data[i].len;
909 	    size_t outbytes = OUTBUF_LEN;
910 	    inbuf = data[i].data;
911 	    outbuf = (char *)ob;
912 
913 	    if (iconv(descs[d], NULL, NULL, (char **)&outbuf, &outbytes)                                                                       == (size_t)-1)
914             {
915                 perror("Can't reset shift state");
916                 CHECK(ERROR);
917             }
918 
919             n = iconv(descs[d++], &(inbuf), &inbytes,
920 	                          &outbuf, &outbytes);
921             if (n == (size_t)-1)
922             {
923 	        printf("Conversion from %s to %s FAILED - iconv() "
924                        "returned -1\n", data[i].name, data[j].name);
925 		perror("");
926                 CHECK(ERROR);
927             }
928 
929 	    if (data[j].len != OUTBUF_LEN - outbytes)
930 	    {
931                 printf("Conversion from %s to %s FAILED",
932                        data[i].name, data[j].name);
933 	        printf(" - bad output buffer length (%ld instead of %lu)\n",
934 		       OUTBUF_LEN - (long) outbytes, (unsigned long) data[j].len);
935                 CHECK(ERROR);
936 	    }
937 
938 	    for (k = 0; k < data[j].len; k++)
939 	    {
940 	        if (ob[k] != data[j].data[k])
941 		{
942                     printf("Conversion from %s to %s FAILED",
943                            data[i].name, data[j].name);
944    	            printf("Error: byte %d is wrong\n", k);
945 		    printf("outbuf value: %#x, inbuf value %#x, "
946 		           "right value: %#x\n",
947           	           (int)ob[k], (int)(data[i].data[k]),
948 		           (int)(data[j].data[k]));
949                     CHECK(ERROR);
950 		}
951 	    }
952 
953 	    printf("iconv from %s to %s was successfully done\n",
954                    data[i].name, data[j].name);
955 
956 	}
957     }
958 
959     d = 0;
960     for (i = 0; i < conversions; i++)
961         for (j = 0; j < conversions; j++)
962             CHECK(iconv_close(descs[d++]) != -1);
963 
964     exit(0);
965 }
966 
967 #else /* #if defined(_ICONV_FROM_ENCODING_UTF_8) || ... */
main(void)968 int main(void)
969 {
970     puts("None of UTF-8, EUC-JP, SHIFT-JIS and UCS-2_INTERNAL converters "
971          "linked, SKIP test");
972     exit(0);
973 }
974 #endif /* #if defined(_ICONV_FROM_ENCODING_UTF_8) || ... */
975