1CURLOPT_CONV_FROM_NETWORK_FUcNuCrTlI_OeNa(s3y)_setopCtURoLpOtPiTo_nCsONV_FROM_NETWORK_FUNCTION(3)
2
3
4
6 CURLOPT_CONV_FROM_NETWORK_FUNCTION - convert data from network to host
7 encoding
8
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_FROM_NETWORK_FUNCTION,
15 conv_callback);
16
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_FROM_NETWORK_FUNCTION converts to host encoding from the
32 network encoding. It is used when commands or ASCII data are received
33 over 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
56 NULL
57
59 FTP, SMTP, IMAP, POP3
60
62 static CURLcode my_conv_from_ascii_to_ebcdic(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_a2e(&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 /* use platform-specific functions for codeset conversions */
78 curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION,
79 my_conv_from_ascii_to_ebcdic);
80
82 Available only if CURL_DOES_CONVERSIONS was defined when libcurl was
83 built.
84
86 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
87 if not.
88
90 CURLOPT_CONV_TO_NETWORK_FUNCTION(3), CURLOPT_CONV_FROM_UTF8_FUNC‐
91 TION(3),
92
93
94
95libcurl 7.69.1 May 31, 2C0U1R7LOPT_CONV_FROM_NETWORK_FUNCTION(3)