Tweet status text not url decoded


#1

Hi All,

So for the couple of days we are having the strange problme eavry time we send a status text to tweeter it is show in Tweet with text still url encoded. We are sending the text in this format for the past 5 months and did not have any promlesm until now. So here is an example

Original text
Hi! - perfect tool for connecting with people and business partners #EXPOREAL #networking

we do this in PHP status = urlencode(text);

And we get on twitte
Hi%21±+perfect+tool+for+connecting+with+people+and++business+partners+%23EXPOREAL+%23networking

I do not know why is tihs happening since as I said all was working fine for the last 5 months


#2

Is this in the Ads API? If so, we rolled out a fix for a defect last week which would have affected this.


#3

Yes this is the ADS API this has happend today on 4 tweets at this time


#4

Check the link I just posted for more information on what changed here.


#5

We are looking at it but as we see text needs to be URL encoded as stated in that post we are doing that but it seams that it is not url decoded on other end. We have also tried sending with and with no HEAD parametar.


#6

I think you should use:

$status = rawurlencode($text);
instead

Try it!


#7

Hi this also does not work

we get tweet with this

Hi%21%20-%20perfect%20tool%20for%20connecting%20with%20people%20and%20business%20partners%20%23EXPOREAL%20%23networking

We still can not see what exact problem is since it work for good part of this year


#8

Few months ago with an update we had a problem with the encode of special characters like “%”, before, it worked well.

Now, they have fixed that.

Which lib are you using?


#9

We have our in house solution. We did not have problems with “%” since it was working when we send text as url encoded it was always url decoded on Twitter side now it seams that they do not url decode it


#10

I’ve tryed few seconds ago, with rawurlencode, with your tweet text and another with %, and all works fine for us.


#11

Do you send some aditional parametars in header or some extra filed on tweet endpoint


#12

Our request params:

"request":{ "params":{ "status":"Hi! - perfect tool for connecting with people and business partners #EXPOREAL #networking", "account_id":"18ce53yv4fv" } }

Response

{ "data_type":"status", "data":{ "created_at":"Mon Aug 22 15:16:48 +0000 2016", "text":"Hi! - perfect tool for connecting with people and business partners #EXPOREAL #networking", "truncated":false, "entities":{ ............

We send it as POST

with cURL, using CURLOPT_POSTFIELDS and encoding all params as

$output = rawurlencode($input);


#13

The only differenc I see is that you urlencode all of the parameters and we only urlencode status. I still do no see what is change since it all work untill today


#17

Ok for some reason if we send text with no urlencode it all works including “%”


#18

@esome: It’s likely that the library you’re using to make the request is also encoding the input text.

For example, if status=hello%20there is passed in when making a request to the POST accounts/:account_id/tweet endpoint and the library encodes the input text, the result will be something like: hello%2520there.

Using twurl and the -t flag, you can compare the outcome using -d, which auto-encodes the text:

$ twurl -t -H ads-api.twitter.com "/1/accounts/xxxxx/tweet" -d "status=hello there"

...
"status=hello+there"
...
$ twurl -t -H ads-api.twitter.com "/1/accounts/xxxxx/tweet" -d "status=hello%20there"
...
"status=hello%2520there"
...

Using twurl, if you want to pass in encoded data, you could use the --raw-data option:

$ twurl -t -H ads-api.twitter.com "/1/accounts/xxxxx/tweet" --raw-data "status=hello%20there"
...
"status=hello+there"
...

The announcement that @andypiper posted relates to a fix of a double-decoding issue. Because we were decoding text twice, your previous requests worked. Moving forward, please pass in non-encoded text.

Hope this helps!


#19

@esome: Did this clear things up?


#20

yes thanks


#21