mtsuyugu #4203(2007/11/18 13:48 GMT) [ C ] Rating1/1=1.00
libcurl を使う場合は curl_easy_escape を使ってエスケープできます。 [a-zA-Z0-9] 以外がエスケープされるようです。
see: curl_easy_escape
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include <stdlib.h> #include <stdio.h> #include "curl/curl.h" int main( int argc, char *argv[] ){ CURL *curl; char *escaped; if( argc < 2 ){ fprintf(stderr, "usage: %s url\n", argv[0] ); return EXIT_FAILURE; } if( !(curl = curl_easy_init()) ){ fprintf(stderr, "failed to init curl\n"); return EXIT_FAILURE; } escaped = curl_easy_escape( curl, argv[1], 0 ); curl_free( curl ); if( !escaped ){ fprintf(stderr, "failed to escape\n"); return EXIT_FAILURE; } printf("%s\n", escaped ); free( escaped ); return EXIT_SUCCESS; }
Rating1/1=1.00-0+
[ reply ]
mtsuyugu
#4203()
[
C
]
Rating1/1=1.00
libcurl を使う場合は curl_easy_escape を使ってエスケープできます。 [a-zA-Z0-9] 以外がエスケープされるようです。
see: curl_easy_escape
Rating1/1=1.00-0+
[ reply ]