Thread of a discussion:

twitterapi: @RoyLeban nbsps will be literally encoded as nbsps (and not
spaces) ^RK

RoyLeban: ....@twitterapi Yup, nbsp is what I need. See @Puzzazz to see what
I'm doing. Any chance bug'll get fixed? If not, what's the real tweet limit?

twitterapi: @RoyLeban it's not a bug. &nbsp are handled like that on
purpose. ^RK

RoyLeban: @twitterapi What does "like that" mean? You count each nbsp as 1
char until you get close to 140 then count them as more? Sounds like a bug
____

Here's the deal: non-breaking spaces are the only thing which work as
non-breaking spaces. I know that sounds like a tautology, but look at the
@Puzzazz feed and you'll see what I need. I tried unicode non-breaking
spaces, I tried UTF8 non-breaking spaces, I tried %20's, I tried multiple
spaces. The only thing that worked properly are   entities and they
work perfectly. Except...

There's a bug in how they're counted. If I don't send very many, I do not
have problems and each   is counted as 1 character. I can send a tweet
of >300 chars that resolves to <140 without problems. However, if the
resulting tweet is close to 140 after the nbsp's are resolved, Twitter
erroneously claims that the tweet is too long. It is not an off-by-one bug
as a tweet of 136 fails. I do not know what the lower bound is.

I don't know for sure, but I think this bug was recently introduced. I have
not had this problem in the past. However, there was one 3-day span in which
no tweets went out, then they suddenly started again. By the time I noticed,
it was too late to do an analysis as I wasn't logging the error message from
Twitter (I am now). It could have been a similar temporary problem.

I'd love to see this bug fixed. If you can't fix it, is it possible to give
me enough information about the bug so that I can at least know what the
true tweet limit is?

Thanks very much!

/Roy


On Thu, Mar 4, 2010 at 7:45 AM, Taylor Singletary <
taylorsinglet...@twitter.com> wrote:

> Hi Roy,
>
> You shouldn't be sending spaces as "&nbsp;" -- 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