24 #ifdef CURL_DOES_CONVERSIONS 37 static iconv_t inbound_cd = (iconv_t)-1;
38 static iconv_t outbound_cd = (iconv_t)-1;
41 #ifndef CURL_ICONV_CODESET_OF_NETWORK 42 # define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" 52 char *input_ptr, *output_ptr;
53 size_t res, in_bytes, out_bytes;
56 if(outbound_cd == (iconv_t)-1) {
57 outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,
59 if(outbound_cd == (iconv_t)-1) {
64 input_ptr = output_ptr =
buffer;
65 in_bytes = out_bytes = length;
66 res = iconv(outbound_cd, &input_ptr, &in_bytes,
67 &output_ptr, &out_bytes);
68 if((res == (
size_t)-1) || (in_bytes != 0)) {
79 CURLcode convert_from_network(
char *buffer,
size_t length)
82 char *input_ptr, *output_ptr;
83 size_t res, in_bytes, out_bytes;
86 if(inbound_cd == (iconv_t)-1) {
88 CURL_ICONV_CODESET_OF_NETWORK);
89 if(inbound_cd == (iconv_t)-1) {
94 input_ptr = output_ptr =
buffer;
95 in_bytes = out_bytes = length;
96 res = iconv(inbound_cd, &input_ptr, &in_bytes,
97 &output_ptr, &out_bytes);
98 if((res == (
size_t)-1) || (in_bytes != 0)) {
108 if(inbound_cd != (iconv_t)-1)
109 (void)iconv_close(inbound_cd);
110 if(outbound_cd != (iconv_t)-1)
111 (
void)iconv_close(outbound_cd);
125 if((this_char >= 0x20) && (this_char < 0x7f)) {
127 (void)convert_from_network(&this_char, 1);
137 && (this_char !=
'\t')
138 && (this_char !=
'\r')
139 && (this_char !=
'\n')) {
#define CURL_ICONV_CODESET_OF_HOST