Hi Roy,

You shouldn't be sending spaces as " " -- that's HTML entity encoding.
It's best to send space characters as "%20" instead.

For example:

You'd set your POST body to:
status=There%20is%20%20%20%20%20space%20for%20love%20in%20%20%20the%20universe

If you were trying to set the status
"There is    space for love in   the universe"

In your signature base string for OAuth you'd have to encode those spaces
one more time:

POST&http%3A%2F%2Fapi.twitter.com
%2F1%2Fstatuses%2Fupdate.xml&oauth_consumer_key%3Dri8JxYK2ddwSV5xIUfNNvQ%26oauth_nonce%3DulF0XQetLMOm5Sr9Yrp027Hzu2mPoTuTqFgshncHBo%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1267717205%26oauth_token%3D819797-torCkTs0XK7H2Y2i1ee5iofqkMC4p7aayeEXRTmlw%26oauth_version%3D1.0%26status%3DThere%2520is%2520%2520%2520%2520%2520space%2520for%2520love%2520in%2520%2520%2520the%2520universe


Not all Twitter API clients will choose to preserve multiple spaces on
display though.

Taylor

On Wed, Mar 3, 2010 at 11:13 PM, Roy Leban <r...@royleban.com> wrote:

> Twitter is rejecting tweets as too long when the nbsp character is
> used. Here is an example tweet in plain text
>
> Clue 5 of 15: R _ C _    _ _ N _    N _ _ E _    _ _ T E R    _    _ _
> _ N E E R    _ N    _ _ R _ C U L T U R E http://www.puzzazz.com/s348
> [140 chars]
>
> And, as I'm sending it with the nbsp characters:
>
> Clue 5 of 15: R&nbsp;_&nbsp;C&nbsp;_&nbsp;&nbsp;
> &nbsp;_&nbsp;_&nbsp;N&nbsp;_&nbsp;&nbsp;
> &nbsp;N&nbsp;_&nbsp;_&nbsp;E&nbsp;_&nbsp;&nbsp;
> &nbsp;_&nbsp;_&nbsp;T&nbsp;E&nbsp;R&nbsp;&nbsp; &nbsp;_&nbsp;&nbsp;
> &nbsp;_&nbsp;_&nbsp;_&nbsp;N&nbsp;E&nbsp;E&nbsp;R&nbsp;&nbsp;
> &nbsp;_&nbsp;N&nbsp;&nbsp;
>
> &nbsp;_&nbsp;_&nbsp;R&nbsp;_&nbsp;C&nbsp;U&nbsp;L&nbsp;T&nbsp;U&nbsp;R&nbsp;E
> http://www.puzzazz.com/s348
>
> If the nbsp's are each counted as 6 characters, this would be 400
> chars, but Twitter accepts tweets like this. For example, this tweet:
>
> http://twitter.com/Puzzazz/status/9781320047
>
> is 114 chars but I send 304 chars with the nbsp's.
>
> I have a guess that this only happens when the resulting tweet is
> exactly 140 chars. To test this theory, I just modified the site to
> shorten that tweet below 140. Sure enough, it works:
>
> http://twitter.com/Puzzazz/status/9963348931
>

Reply via email to