c++ - Issue with the line feed character in libcurl (curlpp) -


i'm using curlpp perform http query, curlpp reporting there illegal characters in url. i've narrowed down url problem variable being read config file (one line, contains information needed). weird thing happens on fedora x64bits installation (i haven't tried other x64bits distros). on 2 development machines runs fine (ubuntu , opensuse, 32bits). i've tried printing ascii code of characters read file , looks normal, however, there line feed character @ end of string. now, character occurs in systems, on fedora system reported illegal character. replacing character null termination character makes program work again.

i wondering if there option force curlpp ignore line feed character. i’ve tried escaping string curl_easy_escape function, converts line feed character percent encoding %0a. this, in turn, not recognized http server existing url (it outputs 404 error).

has encountered issue before? possible ignore character, or best approach replace it?

thanks in advance help!

best regards,

ps: in systems, library versions same (which weird). version of curlpp (0.7.3)

edit: due popular demand, i'm posting code reads variable file.

  std::ifstream keyfile (pathtofile.c_str());   std::stringstream buffer;   buffer << keyfile.rdbuf (); 

the way read key file going dump std::stringstream including end of line character.

one thing can use >> read first whole word finds skipping leading spaces:

std::ifstream keyfile(pathtofile.c_str()); std::string api_key;  // skip leading spaces , read next space // or end of line keyfile >> api_key; 

Comments