1CURLOPT_CONV_TO_NETWORK_FUNCcTuIrOlN_(e3a)sy_setoptCoUpRtLiOoPnTs_CONV_TO_NETWORK_FUNCTION(3)
2
3
4

NAME

6       CURLOPT_CONV_TO_NETWORK_FUNCTION  -  convert  data to network from host
7       encoding
8

SYNOPSIS

10       #include <curl/curl.h>
11
12       CURLcode conv_callback(char *ptr, size_t length);
13
14       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_TO_NETWORK_FUNCTION,
15                                 conv_callback);
16

DESCRIPTION

18       Pass a pointer to your callback function, which should match the proto‐
19       type shown above.
20
21       Applies  to  non-ASCII  platforms. curl_version_info(3) will return the
22       CURL_VERSION_CONV feature bit set if this option is provided.
23
24       The data to be converted is in a buffer pointed to by the  ptr  parame‐
25       ter.   The amount of data to convert is indicated by the length parame‐
26       ter.  The converted data overlays the input data in the buffer  pointed
27       to by the ptr parameter. CURLE_OK must be returned upon successful con‐
28       version.   A  CURLcode  return  value  defined  by  curl.h,   such   as
29       CURLE_CONV_FAILED, should be returned if an error was encountered.
30
31       CURLOPT_CONV_TO_NETWORK_FUNCTION  converts  from  host  encoding to the
32       network encoding.  It is used when commands or ASCII data are sent over
33       the network.
34
35       If  you  set  a  callback  pointer to NULL, or don't set it at all, the
36       built-in libcurl iconv functions will be used.  If HAVE_ICONV  was  not
37       defined  when  libcurl was built, and no callback has been established,
38       conversion will return the CURLE_CONV_REQD error code.
39
40       If HAVE_ICONV  is  defined,  CURL_ICONV_CODESET_OF_HOST  must  also  be
41       defined.  For example:
42
43        #define CURL_ICONV_CODESET_OF_HOST "IBM-1047"
44
45       The  iconv  code  in  libcurl will default the network and UTF8 codeset
46       names as follows:
47
48        #define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"
49
50        #define CURL_ICONV_CODESET_FOR_UTF8   "UTF-8"
51
52       You will need to override these definitions if they  are  different  on
53       your system.
54

DEFAULT

56       NULL
57

PROTOCOLS

59       FTP, SMTP, IMAP, POP3
60

EXAMPLE

62       static CURLcode my_conv_from_ebcdic_to_ascii(char *buffer, size_t length)
63       {
64         char *tempptrin, *tempptrout;
65         size_t bytes = length;
66         int rc;
67         tempptrin = tempptrout = buffer;
68         rc = platform_e2a(&tempptrin, &bytes, &tempptrout, &bytes);
69         if(rc == PLATFORM_CONV_OK) {
70           return CURLE_OK;
71         }
72         else {
73           return CURLE_CONV_FAILED;
74         }
75       }
76
77       curl_easy_setopt(curl, CURLOPT_CONV_TO_NETWORK_FUNCTION,
78                        my_conv_from_ebcdic_to_ascii);
79

AVAILABILITY

81       Available  only  if  CURL_DOES_CONVERSIONS was defined when libcurl was
82       built.
83

RETURN VALUE

85       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
86       if not.
87

SEE ALSO

89       CURLOPT_CONV_FROM_NETWORK_FUNCTION(3),     CURLOPT_CONV_FROM_UTF8_FUNC‐
90       TION(3),
91
92
93
94libcurl 7.71.1                   May 31, 201C7URLOPT_CONV_TO_NETWORK_FUNCTION(3)
Impressum