WEBVTT
Kind: captions
Language: en

1
00:00:00.179 --> 00:00:02.840
There's an old pirate legend
about the Black Spot:

2
00:00:02.840 --> 00:00:04.470
a circular bit of paper, black on one side,

3
00:00:04.470 --> 00:00:06.749
and a message of doom on the other,

4
00:00:06.749 --> 00:00:09.570
that would mark you for judgment or death.

5
00:00:09.570 --> 00:00:12.850
Well, now we have a real Black Spot,
or at least a Black Point.

6
00:00:12.850 --> 00:00:16.340
There is a WhatsApp message going round that
crashes the app

7
00:00:16.340 --> 00:00:18.560
when you touch the black point within it.

8
00:00:18.560 --> 00:00:21.850
And it's a regular, everyday
text rendering bug in Android.

9
00:00:21.850 --> 00:00:24.160
WhatsApp is just how it's spreading.

10
00:00:24.160 --> 00:00:26.250
And I wasn't going to talk about it,

11
00:00:26.250 --> 00:00:30.230
because text rendering bugs are now
pretty commonplace and pretty dull.

12
00:00:30.230 --> 00:00:31.910
There isn't a story there.

13
00:00:31.910 --> 00:00:33.520
You send some weird characters,

14
00:00:33.520 --> 00:00:36.660
you trigger an obscure bug somewhere
in the text renderer,

15
00:00:36.660 --> 00:00:39.690
which is the bit of code that puts text on
the screen,

16
00:00:39.690 --> 00:00:41.399
and because no-one's ever thought to test

17
00:00:41.399 --> 00:00:44.950
that precise combination of characters in
that precise order,

18
00:00:44.950 --> 00:00:47.830
because it'd never happen in everyday conversation,

19
00:00:47.830 --> 00:00:49.260
it crashes.

20
00:00:49.260 --> 00:00:50.700
Just like all the other times.

21
00:00:50.700 --> 00:00:53.149
And it'll get fixed pretty soon.

22
00:00:53.149 --> 00:00:55.809
But there is something interesting in the
characters

23
00:00:55.809 --> 00:00:58.219
that were used to do it this time round.

24
00:00:58.219 --> 00:01:01.720
If you analyse what's actually being sent
in the Black Spot message,

25
00:01:01.720 --> 00:01:04.739
then there are a whole load of
invisible characters.

26
00:01:04.739 --> 00:01:09.180
Unicode, which is the international standard
for transferring text between computers,

27
00:01:09.180 --> 00:01:14.280
contains tens of thousands of characters
designed for every language in the world.

28
00:01:14.280 --> 00:01:17.710
But it also has a few invisible characters
defined in it.

29
00:01:17.710 --> 00:01:19.320
One of those is a zero-width space,

30
00:01:19.320 --> 00:01:20.750
which is designed to indicate a good point

31
00:01:20.750 --> 00:01:23.240
to put a line break in a really long word.

32
00:01:23.240 --> 00:01:26.340
Others dictate whether characters and the
diacritics above or below them

33
00:01:26.340 --> 00:01:29.060
should be combined or left separated.

34
00:01:29.060 --> 00:01:34.280
And a few of them say whether the text should
go left-to-right or right-to-left.

35
00:01:34.280 --> 00:01:36.790
Lots of languages in the world go right-to-left:
for example,

36
00:01:36.790 --> 00:01:40.490
anything that uses Arabic script
or the Hebrew alphabet.

37
00:01:40.490 --> 00:01:42.220
If you're writing in those scripts,

38
00:01:42.220 --> 00:01:45.920
then the Unicode standard takes care
of everything for you:

39
00:01:45.920 --> 00:01:49.299
those characters are
'strongly typed right-to-left'.

40
00:01:49.299 --> 00:01:52.530
Use the Hebrew alphabet and any modern system,
phone or desktop,

41
00:01:52.530 --> 00:01:55.070
will put it right-to-left automatically.

42
00:01:55.070 --> 00:01:56.320
Left-to-right is not the default,

43
00:01:56.320 --> 00:02:00.070
no matter how much the English-speaking world
might think it is.

44
00:02:00.070 --> 00:02:03.920
Those strongly-typed characters mean that
if you want to, say,

45
00:02:03.920 --> 00:02:07.930
put some Hebrew text in the middle
of some English, you can do that:

46
00:02:07.930 --> 00:02:09.590
the bit of code that's rendering the text

47
00:02:09.590 --> 00:02:12.760
will work out how long that right-to-left
sequence is,

48
00:02:12.760 --> 00:02:14.090
leave enough space,

49
00:02:14.090 --> 00:02:16.709
and then carry on with the rest of the
left-to-right text.

50
00:02:16.709 --> 00:02:20.309
Or if you want to put numbers,
which are written left-to-right,

51
00:02:20.309 --> 00:02:25.739
in the middle of Arabic right-to-left text,
then it'll work it out the same way.

52
00:02:25.739 --> 00:02:27.819
Mostly, you don't have to worry about it.

53
00:02:27.819 --> 00:02:30.689
However: there are a lot of
situations — edge cases —

54
00:02:30.689 --> 00:02:32.329
where this goes wrong.

55
00:02:32.329 --> 00:02:35.900
And I am not going to try and describe them,
or even list them,

56
00:02:35.900 --> 00:02:38.069
because they're all really confusing and boring,

57
00:02:38.069 --> 00:02:40.650
but I've put a link to the
Unicode Bidirectional Algorithm

58
00:02:40.650 --> 00:02:43.129
in the description below if
you do want to know the details.

59
00:02:43.129 --> 00:02:45.680
But in short: to help make things clearer,

60
00:02:45.680 --> 00:02:48.760
Unicode defines several types of invisible
character

61
00:02:48.760 --> 00:02:52.079
that tell the text rendering system:
hey, you know that next bit?

62
00:02:52.079 --> 00:02:53.370
Right to left.

63
00:02:53.370 --> 00:02:55.519
Even if it's Latin letters,
put them the other way around.

64
00:02:55.519 --> 00:02:57.109
Or vice versa.

65
00:02:57.109 --> 00:03:01.840
These invisible characters have been used
for quite a bit of trickery over the years:

66
00:03:01.840 --> 00:03:05.400
it used to be that you could put them in a
blog comment or a forum post--

67
00:03:05.400 --> 00:03:10.249
for younger viewers, blogs and forums were
where we talked on the web

68
00:03:10.249 --> 00:03:14.809
back before everyone gave up and just piled
inside a load of walled gardens.

69
00:03:14.809 --> 00:03:19.669
Anyway, put those directional characters in
a comment on a badly-designed site

70
00:03:19.669 --> 00:03:23.640
and suddenly everyone's writing backwards
and it's really confusing,

71
00:03:23.640 --> 00:03:26.439
and that passed for funny ten years ago.

72
00:03:26.439 --> 00:03:31.189
Hidden inside the Black Spot text are about
two thousand invisible characters

73
00:03:31.189 --> 00:03:34.389
that swap the direction of text back and forth.

74
00:03:34.389 --> 00:03:36.389
And they're just regular characters,
strongly typed:

75
00:03:36.389 --> 00:03:41.379
it's like you put a Latin A and a Hebrew א
next to each other a thousand times...

76
00:03:41.379 --> 00:03:45.569
except both of them are invisible and have
a width of zero.

77
00:03:45.569 --> 00:03:48.590
And somewhere in that jumbled mess
the system gets really confused:

78
00:03:48.590 --> 00:03:52.139
it can display the text, at least,
but when you tap it,

79
00:03:52.139 --> 00:03:55.540
it has to work out exactly
what character you've touched,

80
00:03:55.540 --> 00:03:58.159
so you could highlight it
or copy and paste it...

81
00:03:58.159 --> 00:04:03.019
and those thousands of invisible characters
cause a problem,

82
00:04:03.019 --> 00:04:04.799
the details of which will no doubt
be hashed out

83
00:04:04.799 --> 00:04:08.689
by the Android development team in the next
week or two.

84
00:04:08.689 --> 00:04:12.579
Does the black point in the message
have anything to do with it?

85
00:04:12.579 --> 00:04:14.249
No, probably not.

86
00:04:14.249 --> 00:04:16.359
Probably they could have picked any emoji,

87
00:04:16.359 --> 00:04:18.730
or maybe any character at all
and put it in there,

88
00:04:18.730 --> 00:04:21.340
and it would still have worked.
We won't know for a while.

89
00:04:21.340 --> 00:04:26.840
But the Black Spot itself almost certainly
isn't the cause of your phone's doom.

90
00:04:26.840 --> 00:04:29.470
Which is actually true of the original
Black Spot as well.

91
00:04:29.470 --> 00:04:31.580
It's not an old pirate legend.

92
00:04:31.580 --> 00:04:35.620
When he was writing Treasure Island,
author Robert Louis Stevenson just made it up.

