{"action":"created","issue":{"url":"https://api.github.com/repos/swatkat/twitcurl/issues/52","labels_url":"https://api.github.com/repos/swatkat/twitcurl/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/swatkat/twitcurl/issues/52/comments","events_url":"https://api.github.com/repos/swatkat/twitcurl/issues/52/events","html_url":"https://github.com/swatkat/twitcurl/issues/52","id":61813998,"number":52,"title":"URL encoding error","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/swatkat/twitcurl/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/swatkat/twitcurl/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/swatkat/twitcurl/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-15T13:39:51Z","updated_at":"2016-01-19T14:17:56Z","closed_at":null,"body":"```\nWhat steps will reproduce the problem?\n1. Call twitCurl::search with a hashtag search string\n\nWhat is the expected output? What do you see instead?\n\nExpected output is the search results. Actual output is an authentication error.\n\nWhat version of the product are you using? On what operating system?\n\nr122 on Windows 8 x64\n\nPlease provide any additional information below.\n\noauth_signature needs to be generated with the unencoded URL which is done \ncorrectly, however the parameters then need to be encoded before being passed \nto cURL.\n\nHere's what I've done to work around this and I can now search with hashtags:\n\nstd::vector<std::string> &split(const std::string &s, char delim, \nstd::vector<std::string> &elems) {\n    std::stringstream ss(s);\n    std::string item(\"\");\n    while (std::getline(ss, item, delim)) {\n\t\tif (!item.empty())\n\t\t\telems.push_back(item);\n    }\n    return elems;\n}\n\nbool twitCurl::performGet( const std::string& getUrl )\n\n...\n\n\tstd::string request(\"\");\n\t/* Check for parameters */\n\tif (getUrl.find('?')!=std::string::npos)\n\t{\n\t\tstd::size_t divide = getUrl.find_first_of('?')+1;\n\t\tstd::string encodedparams(\"\");\n\t\tstd::string params=getUrl.substr(divide);\n\t\tstd::vector<std::string> vparams;\n\t\tsplit(params,'&',vparams);\n\t\tfor (unsigned int i=0;i<vparams.size();i++)\n\t\t{\n\t\t\tif (i>0) encodedparams+=\"&\";\n\t\t\tstd::size_t pos = vparams[i].find('=');\n\t\t\tif (pos!=std::string::npos)\n\t\t\t\tencodedparams+=vparams[i].substr(0,pos+1)+urlencode(vparams[i].substr(pos+1));\n\t\t\telse\n\t\t\t\tencodedparams+=vparams[i];\n\t\t}\n\t\trequest=getUrl.substr(0,divide)+encodedparams;\n\t}\n\telse\n\t\trequest=getUrl;\n\n\t/* Set http request and url */\n    curl_easy_setopt( m_curlHandle, CURLOPT_HTTPGET, 1 );\n    curl_easy_setopt( m_curlHandle, CURLOPT_URL, request.c_str() );\n```\n\nOriginal issue reported on code.google.com by `sbd...@gmail.com` on 18 Sep 2013 at 1:36"},"comment":{"url":"https://api.github.com/repos/swatkat/twitcurl/issues/comments/172866343","html_url":"https://github.com/swatkat/twitcurl/issues/52#issuecomment-172866343","issue_url":"https://api.github.com/repos/swatkat/twitcurl/issues/52","id":172866343,"user":{"login":"mryqu","id":6701740,"avatar_url":"https://avatars.githubusercontent.com/u/6701740?v=3","gravatar_id":"","url":"https://api.github.com/users/mryqu","html_url":"https://github.com/mryqu","followers_url":"https://api.github.com/users/mryqu/followers","following_url":"https://api.github.com/users/mryqu/following{/other_user}","gists_url":"https://api.github.com/users/mryqu/gists{/gist_id}","starred_url":"https://api.github.com/users/mryqu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mryqu/subscriptions","organizations_url":"https://api.github.com/users/mryqu/orgs","repos_url":"https://api.github.com/users/mryqu/repos","events_url":"https://api.github.com/users/mryqu/events{/privacy}","received_events_url":"https://api.github.com/users/mryqu/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T14:17:56Z","updated_at":"2016-01-19T14:17:56Z","body":"If the query string contains '&', it can't split correctly! It's best to deliver HttpParameter[] httpParams instead of getUrl like twitter4j."}}