1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.encoding;
16
17 import static java.nio.charset.StandardCharsets.ISO_8859_1;
18 import static java.nio.charset.StandardCharsets.UTF_8;
19
20 import java.io.ByteArrayOutputStream;
21 import java.net.URL;
22 import java.nio.charset.Charset;
23 import java.nio.charset.StandardCharsets;
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.List;
27 import java.util.zip.GZIPOutputStream;
28
29 import org.apache.commons.io.ByteOrderMark;
30 import org.apache.commons.lang3.ArrayUtils;
31 import org.htmlunit.MiniServer;
32 import org.htmlunit.WebDriverTestCase;
33 import org.htmlunit.junit.annotation.Alerts;
34 import org.htmlunit.junit.annotation.HtmlUnitNYI;
35 import org.htmlunit.util.MimeType;
36 import org.htmlunit.util.NameValuePair;
37 import org.junit.jupiter.params.ParameterizedTest;
38 import org.junit.jupiter.params.provider.Arguments;
39 import org.junit.jupiter.params.provider.MethodSource;
40 import org.openqa.selenium.WebDriver;
41 import org.openqa.selenium.WebDriverException;
42
43
44
45
46
47
48 public class HtmlPageEncodingTest extends WebDriverTestCase {
49
50 private static final String BOM_UTF_16LE = "BOMUTF16LE";
51 private static final String BOM_UTF_16BE = "BOMUTF16BE";
52 private static final String BOM_UTF_8 = "BOMUTF8";
53
54 private enum TestCharset {
55 UTF8("UTF8", UTF_8),
56 ISO88591("ISO88591", ISO_8859_1),
57 GB2312("GB2312", Charset.forName("GB2312"));
58
59 private final String label_;
60 private final Charset charset_;
61
62 TestCharset(final String label, final Charset charset) {
63 label_ = label;
64 charset_ = charset;
65 }
66
67 @Override
68 public String toString() {
69 return label_;
70 }
71
72 public Charset getCharset() {
73 return charset_;
74 }
75 }
76
77
78
79
80
81
82 public static Collection<Arguments> data() throws Exception {
83 final List<Arguments> list = new ArrayList<>();
84
85 final TestCharset[] charsetResponseHeader = new TestCharset[]
86 {null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.GB2312};
87 final TestCharset[] charsetResponseEncoding = new TestCharset[]
88 {null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.GB2312};
89 final TestCharset[] charsetMeta = new TestCharset[]
90 {null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.GB2312};
91 final String[] bom = {null, BOM_UTF_8, BOM_UTF_16LE, BOM_UTF_16BE};
92
93 for (final Object responseHeader : charsetResponseHeader) {
94 for (final Object responseEncoding : charsetResponseEncoding) {
95 for (final Object meta : charsetMeta) {
96 for (final Object b : bom) {
97 list.add(Arguments.of(responseHeader, responseEncoding, meta, b, false));
98 list.add(Arguments.of(responseHeader, responseEncoding, meta, b, true));
99 }
100 }
101 }
102 }
103 return list;
104 }
105
106
107
108
109
110 @ParameterizedTest(name = "_{0}_{1}_{2}_{3}_{4}")
111 @MethodSource("data")
112 @Alerts("a \u00E4 \u0623\u0647\u0644\u0627\u064B \u043C\u0438\u0440 \u623F\u95F4")
113 void charset(
114 final TestCharset charsetResponseHeader,
115 final TestCharset charsetResponseEncoding,
116 final TestCharset charsetMeta,
117 final String bom,
118 final boolean gzip) throws Exception {
119
120
121 final URL htmlUrl = new URL(URL_FIRST, "" + System.currentTimeMillis() + ".html");
122
123
124 String meta = "";
125 if (charsetMeta != null) {
126 meta = "<meta charset='" + charsetMeta.getCharset().name().toLowerCase() + "' />\n";
127 }
128
129 final String html = DOCTYPE_HTML
130 + "<html><head>\n"
131 + meta
132 + " <title>a ä أهلاً мир 房间</title>\n"
133 + "</head>\n"
134 + "<body>\n"
135 + "</body>\n"
136 + "</html>";
137
138 String contentType = MimeType.TEXT_HTML;
139 if (charsetResponseHeader != null) {
140 contentType = contentType + "; charset=" + charsetResponseHeader.getCharset().name().toLowerCase();
141 }
142
143 byte[] htmlBytes = null;
144 if (charsetResponseEncoding == null) {
145 htmlBytes = html.getBytes(UTF_8);
146 }
147 else {
148 htmlBytes = html.getBytes(charsetResponseEncoding.getCharset());
149 }
150
151 if (BOM_UTF_8.equals(bom)) {
152 htmlBytes = ArrayUtils.addAll(ByteOrderMark.UTF_8.getBytes(), html.getBytes(StandardCharsets.UTF_8));
153 }
154 else if (BOM_UTF_16BE.equals(bom)) {
155 htmlBytes = ArrayUtils.addAll(ByteOrderMark.UTF_16BE.getBytes(), html.getBytes(StandardCharsets.UTF_16BE));
156 }
157 else if (BOM_UTF_16LE.equals(bom)) {
158 htmlBytes = ArrayUtils.addAll(ByteOrderMark.UTF_16LE.getBytes(), html.getBytes(StandardCharsets.UTF_16LE));
159 }
160
161 if (gzip) {
162 final ByteArrayOutputStream bos = new ByteArrayOutputStream();
163 final GZIPOutputStream gout = new GZIPOutputStream(bos);
164 gout.write(htmlBytes);
165 gout.finish();
166
167 final List<NameValuePair> headers = new ArrayList<>();
168 headers.add(new NameValuePair("Content-Encoding", "gzip"));
169 getMockWebConnection().setResponse(htmlUrl, bos.toByteArray(), 200, "OK", contentType, headers);
170 }
171 else {
172 getMockWebConnection().setResponse(htmlUrl, htmlBytes, 200, "OK", contentType, null);
173 }
174
175 try (MiniServer miniServer1 = new MiniServer(PORT, getMockWebConnection())) {
176 miniServer1.start();
177
178 try {
179 final WebDriver driver = getWebDriver();
180 driver.get(htmlUrl.toExternalForm());
181
182 assertEquals(getExpectedAlerts()[0], driver.getTitle());
183 }
184 catch (final WebDriverException e) {
185 if (!e.getCause().getMessage().contains("illegal character")
186 && !e.getCause().getMessage().contains("is not defined.")) {
187 throw e;
188 }
189
190 final String msg = e.getCause().getMessage();
191 assertTrue(msg, msg.contains(getExpectedAlerts()[0]));
192 }
193 }
194 }
195
196 @Alerts("a ? ????? \u043C\u0438\u0440 \u623F\u95F4")
197 void _GB2312_GB2312_GB2312_null_false() throws Exception {
198 charset(TestCharset.GB2312, TestCharset.GB2312, TestCharset.GB2312, null, false);
199 }
200
201 @Alerts("a ? ????? \u043C\u0438\u0440 \u623F\u95F4")
202 void _GB2312_GB2312_GB2312_null_true() throws Exception {
203 charset(TestCharset.GB2312, TestCharset.GB2312, TestCharset.GB2312, null, true);
204 }
205
206 @Alerts("a ? ????? \u043C\u0438\u0440 \u623F\u95F4")
207 void _GB2312_GB2312_ISO88591_null_false() throws Exception {
208 charset(TestCharset.GB2312, TestCharset.GB2312, TestCharset.ISO88591, null, false);
209 }
210
211 @Alerts("a ? ????? \u043C\u0438\u0440 \u623F\u95F4")
212 void _GB2312_GB2312_ISO88591_null_true() throws Exception {
213 charset(TestCharset.GB2312, TestCharset.GB2312, TestCharset.ISO88591, null, true);
214 }
215
216 @Alerts("a ? ????? \u043C\u0438\u0440 \u623F\u95F4")
217 void _GB2312_GB2312_UTF8_null_false() throws Exception {
218 charset(TestCharset.GB2312, TestCharset.GB2312, TestCharset.UTF8, null, false);
219 }
220
221 @Alerts("a ? ????? \u043C\u0438\u0440 \u623F\u95F4")
222 void _GB2312_GB2312_UTF8_null_true() throws Exception {
223 charset(TestCharset.GB2312, TestCharset.GB2312, TestCharset.UTF8, null, true);
224 }
225
226 @Alerts("a ? ????? \u043C\u0438\u0440 \u623F\u95F4")
227 void _GB2312_GB2312_null_null_false() throws Exception {
228 charset(TestCharset.GB2312, TestCharset.GB2312, null, null, false);
229 }
230
231 @Alerts("a ? ????? \u043C\u0438\u0440 \u623F\u95F4")
232 void _GB2312_GB2312_null_null_true() throws Exception {
233 charset(TestCharset.GB2312, TestCharset.GB2312, null, null, true);
234 }
235
236 @Alerts("a � ????? ??? ??")
237 void _GB2312_ISO88591_GB2312_null_false() throws Exception {
238 charset(TestCharset.GB2312, TestCharset.ISO88591, TestCharset.GB2312, null, false);
239 }
240
241 @Alerts("a � ????? ??? ??")
242 void _GB2312_ISO88591_GB2312_null_true() throws Exception {
243 charset(TestCharset.GB2312, TestCharset.ISO88591, TestCharset.GB2312, null, true);
244 }
245
246 @Alerts("a � ????? ??? ??")
247 void _GB2312_ISO88591_ISO88591_null_false() throws Exception {
248 charset(TestCharset.GB2312, TestCharset.ISO88591, TestCharset.ISO88591, null, false);
249 }
250
251 @Alerts("a � ????? ??? ??")
252 void _GB2312_ISO88591_ISO88591_null_true() throws Exception {
253 charset(TestCharset.GB2312, TestCharset.ISO88591, TestCharset.ISO88591, null, true);
254 }
255
256 @Alerts("a � ????? ??? ??")
257 void _GB2312_ISO88591_UTF8_null_false() throws Exception {
258 charset(TestCharset.GB2312, TestCharset.ISO88591, TestCharset.UTF8, null, false);
259 }
260
261 @Alerts("a � ????? ??? ??")
262 void _GB2312_ISO88591_UTF8_null_true() throws Exception {
263 charset(TestCharset.GB2312, TestCharset.ISO88591, TestCharset.UTF8, null, true);
264 }
265
266 @Alerts("a � ????? ??? ??")
267 void _GB2312_ISO88591_null_null_false() throws Exception {
268 charset(TestCharset.GB2312, TestCharset.ISO88591, null, null, false);
269 }
270
271 @Alerts("a � ????? ??? ??")
272 void _GB2312_ISO88591_null_null_true() throws Exception {
273 charset(TestCharset.GB2312, TestCharset.ISO88591, null, null, true);
274 }
275
276 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
277 void _GB2312_UTF8_GB2312_null_false() throws Exception {
278 charset(TestCharset.GB2312, TestCharset.UTF8, TestCharset.GB2312, null, false);
279 }
280
281 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
282 void _GB2312_UTF8_GB2312_null_true() throws Exception {
283 charset(TestCharset.GB2312, TestCharset.UTF8, TestCharset.GB2312, null, true);
284 }
285
286 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
287 void _GB2312_UTF8_ISO88591_null_false() throws Exception {
288 charset(TestCharset.GB2312, TestCharset.UTF8, TestCharset.ISO88591, null, false);
289 }
290
291 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
292 void _GB2312_UTF8_ISO88591_null_true() throws Exception {
293 charset(TestCharset.GB2312, TestCharset.UTF8, TestCharset.ISO88591, null, true);
294 }
295
296 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
297 void _GB2312_UTF8_UTF8_null_false() throws Exception {
298 charset(TestCharset.GB2312, TestCharset.UTF8, TestCharset.UTF8, null, false);
299 }
300
301 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
302 void _GB2312_UTF8_UTF8_null_true() throws Exception {
303 charset(TestCharset.GB2312, TestCharset.UTF8, TestCharset.UTF8, null, true);
304 }
305
306 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
307 void _GB2312_UTF8_null_null_false() throws Exception {
308 charset(TestCharset.GB2312, TestCharset.UTF8, null, null, false);
309 }
310
311 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
312 void _GB2312_UTF8_null_null_true() throws Exception {
313 charset(TestCharset.GB2312, TestCharset.UTF8, null, null, true);
314 }
315
316 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
317 void _GB2312_null_GB2312_null_false() throws Exception {
318 charset(TestCharset.GB2312, null, TestCharset.GB2312, null, false);
319 }
320
321 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
322 void _GB2312_null_GB2312_null_true() throws Exception {
323 charset(TestCharset.GB2312, null, TestCharset.GB2312, null, true);
324 }
325
326 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
327 void _GB2312_null_ISO88591_null_false() throws Exception {
328 charset(TestCharset.GB2312, null, TestCharset.ISO88591, null, false);
329 }
330
331 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
332 void _GB2312_null_ISO88591_null_true() throws Exception {
333 charset(TestCharset.GB2312, null, TestCharset.ISO88591, null, true);
334 }
335
336 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
337 void _GB2312_null_UTF8_null_false() throws Exception {
338 charset(TestCharset.GB2312, null, TestCharset.UTF8, null, false);
339 }
340
341 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
342 void _GB2312_null_UTF8_null_true() throws Exception {
343 charset(TestCharset.GB2312, null, TestCharset.UTF8, null, true);
344 }
345
346 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
347 void _GB2312_null_null_null_false() throws Exception {
348 charset(TestCharset.GB2312, null, null, null, false);
349 }
350
351 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
352 void _GB2312_null_null_null_true() throws Exception {
353 charset(TestCharset.GB2312, null, null, null, true);
354 }
355
356 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
357 void _ISO88591_GB2312_GB2312_null_false() throws Exception {
358 charset(TestCharset.ISO88591, TestCharset.GB2312, TestCharset.GB2312, null, false);
359 }
360
361 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
362 void _ISO88591_GB2312_GB2312_null_true() throws Exception {
363 charset(TestCharset.ISO88591, TestCharset.GB2312, TestCharset.GB2312, null, true);
364 }
365
366 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
367 void _ISO88591_GB2312_ISO88591_null_false() throws Exception {
368 charset(TestCharset.ISO88591, TestCharset.GB2312, TestCharset.ISO88591, null, false);
369 }
370
371 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
372 void _ISO88591_GB2312_ISO88591_null_true() throws Exception {
373 charset(TestCharset.ISO88591, TestCharset.GB2312, TestCharset.ISO88591, null, true);
374 }
375
376 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
377 void _ISO88591_GB2312_UTF8_null_false() throws Exception {
378 charset(TestCharset.ISO88591, TestCharset.GB2312, TestCharset.UTF8, null, false);
379 }
380
381 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
382 void _ISO88591_GB2312_UTF8_null_true() throws Exception {
383 charset(TestCharset.ISO88591, TestCharset.GB2312, TestCharset.UTF8, null, true);
384 }
385
386 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
387 void _ISO88591_GB2312_null_null_false() throws Exception {
388 charset(TestCharset.ISO88591, TestCharset.GB2312, null, null, false);
389 }
390
391 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
392 void _ISO88591_GB2312_null_null_true() throws Exception {
393 charset(TestCharset.ISO88591, TestCharset.GB2312, null, null, true);
394 }
395
396 @Alerts("a ä ????? ??? ??")
397 void _ISO88591_ISO88591_GB2312_null_false() throws Exception {
398 charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.GB2312, null, false);
399 }
400
401 @Alerts("a ä ????? ??? ??")
402 void _ISO88591_ISO88591_GB2312_null_true() throws Exception {
403 charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.GB2312, null, true);
404 }
405
406 @Alerts("a ä ????? ??? ??")
407 void _ISO88591_ISO88591_ISO88591_null_false() throws Exception {
408 charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, null, false);
409 }
410
411 @Alerts("a ä ????? ??? ??")
412 void _ISO88591_ISO88591_ISO88591_null_true() throws Exception {
413 charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, null, true);
414 }
415
416 @Alerts("a ä ????? ??? ??")
417 void _ISO88591_ISO88591_UTF8_null_false() throws Exception {
418 charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, null, false);
419 }
420
421 @Alerts("a ä ????? ??? ??")
422 void _ISO88591_ISO88591_UTF8_null_true() throws Exception {
423 charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, null, true);
424 }
425
426 @Alerts("a ä ????? ??? ??")
427 void _ISO88591_ISO88591_null_null_false() throws Exception {
428 charset(TestCharset.ISO88591, TestCharset.ISO88591, null, null, false);
429 }
430
431 @Alerts("a ä ????? ??? ??")
432 void _ISO88591_ISO88591_null_null_true() throws Exception {
433 charset(TestCharset.ISO88591, TestCharset.ISO88591, null, null, true);
434 }
435
436 @Alerts("a ä أهلاً мир 房间")
437 void _ISO88591_UTF8_GB2312_null_false() throws Exception {
438 charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.GB2312, null, false);
439 }
440
441 @Alerts("a ä أهلاً мир 房间")
442 void _ISO88591_UTF8_GB2312_null_true() throws Exception {
443 charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.GB2312, null, true);
444 }
445
446 @Alerts("a ä أهلاً мир 房间")
447 void _ISO88591_UTF8_ISO88591_null_false() throws Exception {
448 charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, null, false);
449 }
450
451 @Alerts("a ä أهلاً мир 房间")
452 void _ISO88591_UTF8_ISO88591_null_true() throws Exception {
453 charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, null, true);
454 }
455
456 @Alerts("a ä أهلاً мир 房间")
457 void _ISO88591_UTF8_UTF8_null_false() throws Exception {
458 charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, null, false);
459 }
460
461 @Alerts("a ä أهلاً мир 房间")
462 void _ISO88591_UTF8_UTF8_null_true() throws Exception {
463 charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, null, true);
464 }
465
466 @Alerts("a ä أهلاً мир 房间")
467 void _ISO88591_UTF8_null_null_false() throws Exception {
468 charset(TestCharset.ISO88591, TestCharset.UTF8, null, null, false);
469 }
470
471 @Alerts("a ä أهلاً мир 房间")
472 void _ISO88591_UTF8_null_null_true() throws Exception {
473 charset(TestCharset.ISO88591, TestCharset.UTF8, null, null, true);
474 }
475
476 @Alerts("a ä أهلاً мир 房间")
477 void _ISO88591_null_GB2312_null_false() throws Exception {
478 charset(TestCharset.ISO88591, null, TestCharset.GB2312, null, false);
479 }
480
481 @Alerts("a ä أهلاً мир 房间")
482 void _ISO88591_null_GB2312_null_true() throws Exception {
483 charset(TestCharset.ISO88591, null, TestCharset.GB2312, null, true);
484 }
485
486 @Alerts("a ä أهلاً мир 房间")
487 void _ISO88591_null_ISO88591_null_false() throws Exception {
488 charset(TestCharset.ISO88591, null, TestCharset.ISO88591, null, false);
489 }
490
491 @Alerts("a ä أهلاً мир 房间")
492 void _ISO88591_null_ISO88591_null_true() throws Exception {
493 charset(TestCharset.ISO88591, null, TestCharset.ISO88591, null, true);
494 }
495
496 @Alerts("a ä أهلاً мир 房间")
497 void _ISO88591_null_UTF8_null_false() throws Exception {
498 charset(TestCharset.ISO88591, null, TestCharset.UTF8, null, false);
499 }
500
501 @Alerts("a ä أهلاً мир 房间")
502 void _ISO88591_null_UTF8_null_true() throws Exception {
503 charset(TestCharset.ISO88591, null, TestCharset.UTF8, null, true);
504 }
505
506 @Alerts("a ä أهلاً мир 房间")
507 void _ISO88591_null_null_null_false() throws Exception {
508 charset(TestCharset.ISO88591, null, null, null, false);
509 }
510
511 @Alerts("a ä أهلاً мир 房间")
512 void _ISO88591_null_null_null_true() throws Exception {
513 charset(TestCharset.ISO88591, null, null, null, true);
514 }
515
516 @Alerts("a ? ????? �ާڧ� ����")
517 void _UTF8_GB2312_GB2312_null_false() throws Exception {
518 charset(TestCharset.UTF8, TestCharset.GB2312, TestCharset.GB2312, null, false);
519 }
520
521 @Alerts("a ? ????? �ާڧ� ����")
522 void _UTF8_GB2312_GB2312_null_true() throws Exception {
523 charset(TestCharset.UTF8, TestCharset.GB2312, TestCharset.GB2312, null, true);
524 }
525
526 @Alerts("a ? ????? �ާڧ� ����")
527 void _UTF8_GB2312_ISO88591_null_false() throws Exception {
528 charset(TestCharset.UTF8, TestCharset.GB2312, TestCharset.ISO88591, null, false);
529 }
530
531 @Alerts("a ? ????? �ާڧ� ����")
532 void _UTF8_GB2312_ISO88591_null_true() throws Exception {
533 charset(TestCharset.UTF8, TestCharset.GB2312, TestCharset.ISO88591, null, true);
534 }
535
536 @Alerts("a ? ????? �ާڧ� ����")
537 void _UTF8_GB2312_UTF8_null_false() throws Exception {
538 charset(TestCharset.UTF8, TestCharset.GB2312, TestCharset.UTF8, null, false);
539 }
540
541 @Alerts("a ? ????? �ާڧ� ����")
542 void _UTF8_GB2312_UTF8_null_true() throws Exception {
543 charset(TestCharset.UTF8, TestCharset.GB2312, TestCharset.UTF8, null, true);
544 }
545
546 @Alerts("a ? ????? �ާڧ� ����")
547 void _UTF8_GB2312_null_null_false() throws Exception {
548 charset(TestCharset.UTF8, TestCharset.GB2312, null, null, false);
549 }
550
551 @Alerts("a ? ????? �ާڧ� ����")
552 void _UTF8_GB2312_null_null_true() throws Exception {
553 charset(TestCharset.UTF8, TestCharset.GB2312, null, null, true);
554 }
555
556 @Alerts("a � ????? ??? ??")
557 void _UTF8_ISO88591_GB2312_null_false() throws Exception {
558 charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.GB2312, null, false);
559 }
560
561 @Alerts("a � ????? ??? ??")
562 void _UTF8_ISO88591_GB2312_null_true() throws Exception {
563 charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.GB2312, null, true);
564 }
565
566 @Alerts("a � ????? ??? ??")
567 void _UTF8_ISO88591_ISO88591_null_false() throws Exception {
568 charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, null, false);
569 }
570
571 @Alerts("a � ????? ??? ??")
572 void _UTF8_ISO88591_ISO88591_null_true() throws Exception {
573 charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, null, true);
574 }
575
576 @Alerts("a � ????? ??? ??")
577 void _UTF8_ISO88591_UTF8_null_false() throws Exception {
578 charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, null, false);
579 }
580
581 @Alerts("a � ????? ??? ??")
582 void _UTF8_ISO88591_UTF8_null_true() throws Exception {
583 charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, null, true);
584 }
585
586 @Alerts("a � ????? ??? ??")
587 void _UTF8_ISO88591_null_null_false() throws Exception {
588 charset(TestCharset.UTF8, TestCharset.ISO88591, null, null, false);
589 }
590
591 @Alerts("a � ????? ??? ??")
592 void _UTF8_ISO88591_null_null_true() throws Exception {
593 charset(TestCharset.UTF8, TestCharset.ISO88591, null, null, true);
594 }
595
596 @Alerts("a ? ????? мир 房间")
597 void _null_GB2312_GB2312_null_false() throws Exception {
598 charset(null, TestCharset.GB2312, TestCharset.GB2312, null, false);
599 }
600
601 @Alerts("a ? ????? мир 房间")
602 void _null_GB2312_GB2312_null_true() throws Exception {
603 charset(null, TestCharset.GB2312, TestCharset.GB2312, null, true);
604 }
605
606 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
607 void _null_GB2312_ISO88591_null_false() throws Exception {
608 charset(null, TestCharset.GB2312, TestCharset.ISO88591, null, false);
609 }
610
611 @Alerts("a ? ????? §Þ§Ú§â ·¿¼ä")
612 void _null_GB2312_ISO88591_null_true() throws Exception {
613 charset(null, TestCharset.GB2312, TestCharset.ISO88591, null, true);
614 }
615
616 @Alerts("a ? ????? �ާڧ� ����")
617 void _null_GB2312_UTF8_null_false() throws Exception {
618 charset(null, TestCharset.GB2312, TestCharset.UTF8, null, false);
619 }
620
621 @Alerts("a ? ????? �ާڧ� ����")
622 void _null_GB2312_UTF8_null_true() throws Exception {
623 charset(null, TestCharset.GB2312, TestCharset.UTF8, null, true);
624 }
625
626 @Alerts(DEFAULT = "a ? ????? §Þ§Ú§â ·¿¼ä",
627 FF = "a ? ????? 技我把 滇潔",
628 FF_ESR = "a ? ????? 技我把 滇潔")
629 @HtmlUnitNYI(FF = "a ? ????? §Þ§Ú§â ·¿¼ä",
630 FF_ESR = "a ? ????? §Þ§Ú§â ·¿¼ä")
631 void _null_GB2312_null_null_false() throws Exception {
632 charset(null, TestCharset.GB2312, null, null, false);
633 }
634
635 @Alerts(DEFAULT = "a ? ????? §Þ§Ú§â ·¿¼ä",
636 FF = "a ? ????? 技我把 滇潔",
637 FF_ESR = "a ? ????? 技我把 滇潔")
638 @HtmlUnitNYI(FF = "a ? ????? §Þ§Ú§â ·¿¼ä",
639 FF_ESR = "a ? ????? §Þ§Ú§â ·¿¼ä")
640 void _null_GB2312_null_null_true() throws Exception {
641 charset(null, TestCharset.GB2312, null, null, true);
642 }
643
644 @Alerts("a � ????? ??? ??")
645 void _null_ISO88591_GB2312_null_false() throws Exception {
646 charset(null, TestCharset.ISO88591, TestCharset.GB2312, null, false);
647 }
648
649 @Alerts("a � ????? ??? ??")
650 void _null_ISO88591_GB2312_null_true() throws Exception {
651 charset(null, TestCharset.ISO88591, TestCharset.GB2312, null, true);
652 }
653
654 @Alerts("a ä ????? ??? ??")
655 void _null_ISO88591_ISO88591_null_false() throws Exception {
656 charset(null, TestCharset.ISO88591, TestCharset.ISO88591, null, false);
657 }
658
659 @Alerts("a ä ????? ??? ??")
660 void _null_ISO88591_ISO88591_null_true() throws Exception {
661 charset(null, TestCharset.ISO88591, TestCharset.ISO88591, null, true);
662 }
663
664 @Alerts("a � ????? ??? ??")
665 void _null_ISO88591_UTF8_null_false() throws Exception {
666 charset(null, TestCharset.ISO88591, TestCharset.UTF8, null, false);
667 }
668
669 @Alerts("a � ????? ??? ??")
670 void _null_ISO88591_UTF8_null_true() throws Exception {
671 charset(null, TestCharset.ISO88591, TestCharset.UTF8, null, true);
672 }
673
674 @Alerts("a ä ????? ??? ??")
675 void _null_ISO88591_null_null_false() throws Exception {
676 charset(null, TestCharset.ISO88591, null, null, false);
677 }
678
679 @Alerts("a ä ????? ??? ??")
680 void _null_ISO88591_null_null_true() throws Exception {
681 charset(null, TestCharset.ISO88591, null, null, true);
682 }
683
684 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
685 void _null_UTF8_GB2312_null_true() throws Exception {
686 charset(null, TestCharset.UTF8, TestCharset.GB2312, null, true);
687 }
688
689 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
690 void _null_UTF8_GB2312_null_false() throws Exception {
691 charset(null, TestCharset.UTF8, TestCharset.GB2312, null, false);
692 }
693
694 @Alerts("a ä أهلاً мир 房间")
695 void _null_UTF8_ISO88591_null_true() throws Exception {
696 charset(null, TestCharset.UTF8, TestCharset.ISO88591, null, true);
697 }
698
699 @Alerts("a ä أهلاً мир 房间")
700 void _null_UTF8_ISO88591_null_false() throws Exception {
701 charset(null, TestCharset.UTF8, TestCharset.ISO88591, null, false);
702 }
703
704 @Alerts("a ä أهلاً мир 房间")
705 void _null_UTF8_null_null_true() throws Exception {
706 charset(null, TestCharset.UTF8, null, null, true);
707 }
708
709 @Alerts("a ä أهلاً мир 房间")
710 void _null_UTF8_null_null_false() throws Exception {
711 charset(null, TestCharset.UTF8, null, null, false);
712 }
713
714 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
715 void _null_null_GB2312_null_false() throws Exception {
716 charset(null, null, TestCharset.GB2312, null, false);
717 }
718
719 @Alerts("a 盲 兀賴賱丕賸 屑懈褉 鎴块棿")
720 void _null_null_GB2312_null_true() throws Exception {
721 charset(null, null, TestCharset.GB2312, null, true);
722 }
723
724 @Alerts("a ä أهلاً мир 房间")
725 void _null_null_ISO88591_null_false() throws Exception {
726 charset(null, null, TestCharset.ISO88591, null, false);
727 }
728
729 @Alerts("a ä أهلاً мир 房间")
730 void _null_null_ISO88591_null_true() throws Exception {
731 charset(null, null, TestCharset.ISO88591, null, true);
732 }
733
734 @Alerts("a ä أهلاً мир 房间")
735 void _null_null_null_null_false() throws Exception {
736 charset(null, null, null, null, false);
737 }
738
739 @Alerts("a ä أهلاً мир 房间")
740 void _null_null_null_null_true() throws Exception {
741 charset(null, null, null, null, true);
742 }
743 }