@@ -12,6 +12,47 @@ public void testIllFormedUtf8SuccessorByteNotConsumed() throws Exception {
12
12
withTerminalSized (5 , 5 );
13
13
mTerminal .append (new byte []{(byte ) 0b11101111, (byte ) 'a' }, 2 );
14
14
assertLineIs (0 , ((char ) TerminalEmulator .UNICODE_REPLACEMENT_CHAR ) + "a " );
15
+
16
+ // https://code.google.com/p/chromium/issues/detail?id=212704
17
+ byte [] input = new byte []{
18
+ (byte ) 0x61 , (byte ) 0xF1 ,
19
+ (byte ) 0x80 , (byte ) 0x80 ,
20
+ (byte ) 0xe1 , (byte ) 0x80 ,
21
+ (byte ) 0xc2 , (byte ) 0x62 ,
22
+ (byte ) 0x80 , (byte ) 0x63 ,
23
+ (byte ) 0x80 , (byte ) 0xbf ,
24
+ (byte ) 0x64
25
+ };
26
+ withTerminalSized (10 , 2 );
27
+ mTerminal .append (input , input .length );
28
+ assertLinesAre ("a\uFFFD \uFFFD \uFFFD b\uFFFD c\uFFFD \uFFFD d" , " " );
29
+
30
+ // Surrogate pairs.
31
+ withTerminalSized (5 , 2 );
32
+ input = new byte []{
33
+ (byte ) 0xed , (byte ) 0xa0 ,
34
+ (byte ) 0x80 , (byte ) 0xed ,
35
+ (byte ) 0xad , (byte ) 0xbf ,
36
+ (byte ) 0xed , (byte ) 0xae ,
37
+ (byte ) 0x80 , (byte ) 0xed ,
38
+ (byte ) 0xbf , (byte ) 0xbf
39
+ };
40
+ mTerminal .append (input , input .length );
41
+ assertLinesAre ("\uFFFD \uFFFD \uFFFD \uFFFD " , " " );
42
+
43
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=746900: "with this patch 0xe0 0x80 is decoded as two U+FFFDs,
44
+ // but 0xe0 0xa0 is decoded as a single U+FFFD, and this is correct according to the "Best Practices", but IE
45
+ // and Chrome (Version 22.0.1229.94) decode both of them as two U+FFFDs. Opera 12.11 decodes both of them as
46
+ // one U+FFFD".
47
+ withTerminalSized (5 , 2 );
48
+ input = new byte []{(byte ) 0xe0 , (byte ) 0xa0 , ' ' };
49
+ mTerminal .append (input , input .length );
50
+ assertLinesAre ("\uFFFD " , " " );
51
+
52
+ // withTerminalSized(5, 2);
53
+ // input = new byte[]{(byte) 0xe0, (byte) 0x80, 'a'};
54
+ // mTerminal.append(input, input.length);
55
+ // assertLinesAre("\uFFFD\uFFFDa ", " ");
15
56
}
16
57
17
58
public void testUnassignedCodePoint () throws UnsupportedEncodingException {
0 commit comments