Operators and special characters not working in version 1.1



I am trying to use search API by using version 1.1, after getting the authentication, it’s working fine, but special characters and operators like AND, OR NOT is not working in this new version.

Anyone have any idea about this


In what way are they not working? Make sure you’re encoding your query correctly. Space characters should be represented by “%20” – special characters should also be escaped. The old search API was lenient, but the new API is strict.


yes already we are sending encoded query string only.

we are passing like this:

$query = array( // query parameters
’q’ => ‘globe OR @talk2globe OR @enjoyglobe’,
‘count’ => ‘10’,
//‘include_entities’ => ‘true’

$oauth = array(
‘oauth_consumer_key’ => $consumer_key,
‘oauth_token’ => $token,
‘oauth_nonce’ => (string)mt_rand(), // a stronger nonce is recommended
’oauth_timestamp’ => time(),
‘oauth_signature_method’ => ‘HMAC-SHA1’,
‘oauth_version’ => ‘1.0’

$oauth = array_map(“rawurlencode”, $oauth); // must be encoded before sorting
$query = array_map(“rawurlencode”, $query);
$query[‘geocode’] = urldecode($query[‘geocode’]);
$arr = array_merge($oauth, $query); // combine the values THEN sort

asort($arr); // secondary sort (value)
ksort($arr); // primary sort (key)

$url = “https://$host$path”;

// mash everything together for the text to hash
$base_string = $method."&".rawurlencode($url)."&".rawurlencode($querystring);

$key = rawurlencode($consumer_secret)."&".rawurlencode($token_secret);

// generate the hash
$signature = rawurlencode(base64_encode(hash_hmac(‘sha1’, $base_string, $key, true)));


Hi All

Need help on this. Spent an entire day after adapting to 1.1 and making oauth changes. Now it’s erratic. My hypothesis is that this could be special character issue. A couple of tweets where it fails are “Google Play app: Pet Care - How To Videos” and “connect directly xyz, Pediatric Dentistry from Tempe, AZ, on”. Something that works is "sample string without any special character"
FYI, I use JS ouath.
EDIT: some more info
I can see commas, exclamations, hyphens etc, in tweets where it fails. Any help is appreciated.
There is some encoding happening inside oauth lib already. I make a jquery ajax post. If I try to encode POST data (data : encodeuricomponent(params[‘status’])), then every tweet fails. I guess it does not match with the base signature formatted by oauth lib.