1 /*
2 * @(#)convert_md.c 1.2 00/11/22
3 *
4 * Copyright 1995-1998 by Sun Microsystems, Inc.,
5 * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
6 * All rights reserved.
7 *
8 * This software is the confidential and proprietary information
9 * of Sun Microsystems, Inc. ("Confidential Information"). You
10 * shall not disclose such Confidential Information and shall use
11 * it only in accordance with the terms of the license agreement
12 * you entered into with Sun.
13 * Use is subject to license terms.
14 */
16 #include <stdio.h>
17 //#include <errno.h>
18 #include <string.h>
20 #ifdef UNIX
21 #include <langinfo.h>
22 #include <iconv.h>
23 #include <locale.h>
24 #include <stdlib.h>
28 static iconv_t
32 // if (errno == EINVAL) {
33 //if (0)
34 /* There is a bug in some versions of Solaris in which
35 * nl_langinfo() returns a string beginning with ISO, but you
36 * have to remove the ISO before calling open_iconv.
37 */
38 // if (strncmp(from, "ISO", 3) == 0) {
39 // /* Try again, but with the ISO in front of the "from" */
40 // return open_iconv(to, from + 3);
41 // } else if (strncmp(to, "ISO", 3) == 0) {
42 // /* Try again, but with the ISO in front of the "to" */
43 // return open_iconv(to + 3, from);
44 // } else {
45 // fprintf(stderr, "%s to %s not supported on this platform\n",
46 // from, to);
47 // }
48 //} else {
49 // perror("iconv_open error: ");
50 //}
52 }
54 }
58 {
65 }
66 }
68 }
74 iconv_t ic;
76 /* don't invoke 'iconv' functions to do the
77 * conversion if it's already in UTF-8 encoding
78 */
81 }
92 }
96 }
103 iconv_t ic;
106 /* Don't do the conversion if it's
107 * already in UTF-8 encoding
108 * Copy over the 'from' to 'to'.
109 */
112 }
123 }
127 }
130 #endif
131 #ifdef WIN32
133 #include <WINDOWS.H>
144 }
153 }
154 #endif