comparison src/vbuf.c @ 93:cb14583c119a

iconv changes for Mac
author Carl Byington <carl@five-ten-sg.com>
date Thu, 28 Aug 2008 15:25:53 -0700
parents 3cb02cb1e6cd
children ed2a260bbb98
comparison
equal deleted inserted replaced
92:93ce964a3f92 93:cb14583c119a
1 1
2 #include <ctype.h> 2 #include <ctype.h>
3 #include <errno.h> 3 #include <errno.h>
4 #include <iconv.h> 4 #include <iconv.h>
5 #include <limits.h> 5 #include <limits.h>
6 #include <malloc.h>
7 #include <signal.h> 6 #include <signal.h>
8 #include <stdarg.h> 7 #include <stdarg.h>
9 #include <stdio.h> 8 #include <stdio.h>
10 #include <stdlib.h> 9 #include <stdlib.h>
11 #include <string.h> 10 #include <string.h>
69 char dump[4]; 68 char dump[4];
70 69
71 if (unicode_up) 70 if (unicode_up)
72 unicode_close(); 71 unicode_close();
73 72
74 if ((iconv_t) - 1 == (i16to8 = iconv_open("UTF-8", "UTF-16"))) { 73 if ((iconv_t) - 1 == (i16to8 = iconv_open("UTF-8", "UTF-16LE"))) {
75 fprintf(stderr, "doexport(): Couldn't open iconv descriptor for UTF-16 to UTF-8.\n"); 74 fprintf(stderr, "doexport(): Couldn't open iconv descriptor for UTF-16LE to UTF-8.\n");
76 exit(1); 75 exit(1);
77 } 76 }
78 77
79 if ((iconv_t) - 1 == (i8to16 = iconv_open("UTF-16", "UTF-8"))) { 78 if ((iconv_t) - 1 == (i8to16 = iconv_open("UTF-16LE", "UTF-8"))) {
80 fprintf(stderr, "doexport(): Couldn't open iconv descriptor for UTF-8 to UTF-16.\n"); 79 fprintf(stderr, "doexport(): Couldn't open iconv descriptor for UTF-8 to UTF-16LE.\n");
81 exit(2); 80 exit(2);
82 } 81 }
83 //iconv will prefix output with an FF FE (utf-16 start seq), the following dumps that. 82 //iconv will prefix output with an FF FE (utf-16 start seq), the following dumps that.
84 memset(dump, 'x', 4); 83 memset(dump, 'x', 4);
85 ASSERT(0 == utf8to16(wipe, 1, dump, 4), "unicode_init(): attempt to dump FF FE failed."); 84 ASSERT(0 == utf8to16(wipe, 1, dump, 4), "unicode_init(): attempt to dump FF FE failed.");