36

Today I was surprised to see that a guy has hacked Twitter's 140-character limit. The message consists of 930 characters. How could this be possible?

The direct link to this tweet is here. For convenience, I'm copying the screenshot of full tweet below:

enter image description here

5
  • 1
    It seems to be a cool trick, but its not a solution for the limit of 140 chars. Actually its BETTER. Because people will state clearly what they need to tell, instead of writing all the rubbish. :)
    – user14867
    Nov 15, 2011 at 17:21
  • 1
    So guys, it might be useful information, in the center of the message there is frase in Russian: Твиттим и не ограничиваемся людиии!!!!!! 140 не предел! Which in English is: Keep twitting without limits, people!!!!! 140 is not a limit! I guess some Russian "hakers"? :-)
    – Worker
    Nov 16, 2011 at 18:33
  • It seems that Twitter has fixed that bug. Check out the direct link to the tweet. Nov 18, 2011 at 21:14
  • The short answer: the tweet has less than 140 characters; it's just an encoding issue that's causing your browser to display it as more characters. Dec 7, 2011 at 4:13
  • A comment below states issue has been fixed by twitter. Today I came across another tweet which is quite similar - twitter.com/#!/luchetti/status/177524100930084864
    – Chethan S.
    Mar 15, 2012 at 17:57

2 Answers 2

41

The message contains Unicode surrogate code points that are improperly encoded as UTF-8. This kind of improper encoding is also called CESU-8. It appears that some Twitter interfaces will accept the CESU-8 encoded surrogate code points as characters (for the purpose of the 140 character limit), but for display purposes it expects valid UTF-8 and these are not valid UTF-8 sequences. So it instead displays the 3 bytes of each of these sequences as 3 C-style octal escape sequences of 4 characters each, and each surrogate code point ends up being displayed using 12 characters.

For example \355\240\265\355\263\220 when decoded as C-escaped UTF-8, without rejecting surrogates as would normally be done when decoding UTF-8, decodes to the surrogate pair U+D835 U+DCD0. Treating this surrogate pair as UTF-16, as would be done when decoding CESU-8, produces the Unicode character U+1D4D0 MATHEMATICAL BOLD SCRIPT CAPITAL A (𝓐).

If the C-style octal escaping is decoded and then the result is interpreted as CESU-8, it comes out to:

𝓐𝓛𝓜𝓐𝓣𝓨 𝓐𝓛𝓜𝓐𝓣𝓨 𝓐𝓛𝓜𝓐𝓣𝓨 Твиттим и не ограничиваемся людиии!!!!!! 140 не предел!=)))) 𝓐𝓛𝓜𝓐𝓣𝓨 𝓐𝓛𝓜𝓐𝓣𝓨 𝓐𝓛𝓜𝓐𝓣𝓨

Here it is as an image, for those without a full set of Unicode fonts installed:

𝓐𝓛𝓜𝓐𝓣𝓨 𝓐𝓛𝓜𝓐𝓣𝓨 𝓐𝓛𝓜𝓐𝓣𝓨 Твиттим и не ограничиваемся людиии!!!!!! 140 не предел!=)))) 𝓐𝓛𝓜𝓐𝓣𝓨 𝓐𝓛𝓜𝓐𝓣𝓨 𝓐𝓛𝓜𝓐𝓣𝓨

3
  • 1
    actually 101 characters - good job @mark4o
    – Jörg
    Nov 17, 2011 at 9:07
  • 3
    It seems that Twitter has fixed that bug. Now the message appears just as the image you posted in your answer. Nov 18, 2011 at 21:13
  • I still see the square boxes, @MehperC.Palavuzlar. Is it possible that I don't have ANY fonts installed with a full set of Unicode chars?
    – Gaia
    Oct 25, 2013 at 19:27
3

Each group of characters beginning with a backslash and followed by three numbers is an "Escape Sequence". Each of them represents a single character. These are usually used for characters that don't exist on your keyboard such as non-English-language characters and symbols.

My guess is that when counting the characters, Twitter is counting each of these groups as a single character but when displaying them to the browser it is printing them as four.

Update:

Some of the escape sequences available are "control characters". These tell the computer to do something such as playing an alert sound or moving the cursor left or right or up or down or deleting the character to the left of the cursor. Although none of them are the last one I mentioned (deleting the previous character), he might have used that character to confuse Twitter as well.

Interestingly, when turned back into normal characters, it is quite repetative and looks something like this:

í µ í ³ í µ í ³ › í µ í ³ œ í µ í ³ í µ í ³ £ í µ í ³ ¨ í µ í ³ í µ í ³ › í µ í ³ œ í µ í ³ í µ í ³ £ í µ í ³ ¨ 

Update 2:

The explanation he gave was "Пишите в DM, всегда на связи )" which Google Translate tells me is "Write to the DM, always on connection)". I'm not sure exactly what that means or how it helps.

5
  • 1
    I thought of that as well (it's the most reasonable explanation that comes to my mind), but the problem is that there are way more than 140 groups of four (140*4 = 560, which is less than the 930 count that Mepher stated).
    – Alex
    Nov 15, 2011 at 15:10
  • @Alex: That's right. I tried copying and pasting the whole message into a new tweet box, but Twitter says it's more than 140 chars. I also tried in TweetDeck but again no go. Nov 15, 2011 at 15:16
  • Well spotted. I've updated my answer but I can't see any evidence that the update is what actually happened.
    – Ladadadada
    Nov 15, 2011 at 15:53
  • 2
    @Mehper you couldn't just copy it to a tweet box, because then twitter would interpret it as separate characters ('\', '3', '5', '5') etc. You would have to create a script which sends the "symbols" as bytes, not escape characters.
    – Tor Valamo
    Nov 15, 2011 at 18:46
  • "Пишите в DM, всегда на связи )" means he invites you to send him a private message, he'll respond to it quickly. My translation would be: "Send a DM, I'm always there".
    – Malcolm
    Dec 8, 2011 at 20:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.