1[
2  "Basics",
3  {
4    "input": "text/html;charset=gbk",
5    "output": "text/html;charset=gbk",
6    "navigable": true,
7    "encoding": "GBK"
8  },
9  {
10    "input": "TEXT/HTML;CHARSET=GBK",
11    "output": "text/html;charset=GBK",
12    "navigable": true,
13    "encoding": "GBK"
14  },
15  "Legacy comment syntax",
16  {
17    "input": "text/html;charset=gbk(",
18    "output": "text/html;charset=\"gbk(\"",
19    "navigable": true,
20    "encoding": null
21  },
22  {
23    "input": "text/html;x=(;charset=gbk",
24    "output": "text/html;x=\"(\";charset=gbk",
25    "navigable": true,
26    "encoding": "GBK"
27  },
28  "Duplicate parameter",
29  {
30    "input": "text/html;charset=gbk;charset=windows-1255",
31    "output": "text/html;charset=gbk",
32    "navigable": true,
33    "encoding": "GBK"
34  },
35  {
36    "input": "text/html;charset=();charset=GBK",
37    "output": "text/html;charset=\"()\"",
38    "navigable": true,
39    "encoding": null
40  },
41  "Spaces",
42  {
43    "input": "text/html;charset =gbk",
44    "output": "text/html",
45    "navigable": true,
46    "encoding": null
47  },
48  {
49    "input": "text/html ;charset=gbk",
50    "output": "text/html;charset=gbk",
51    "navigable": true,
52    "encoding": "GBK"
53  },
54  {
55    "input": "text/html; charset=gbk",
56    "output": "text/html;charset=gbk",
57    "navigable": true,
58    "encoding": "GBK"
59  },
60  {
61    "input": "text/html;charset= gbk",
62    "output": "text/html;charset=\" gbk\"",
63    "navigable": true,
64    "encoding": "GBK"
65  },
66  {
67    "input": "text/html;charset= \"gbk\"",
68    "output": "text/html;charset=\" \\\"gbk\\\"\"",
69    "navigable": true,
70    "encoding": null
71  },
72  "0x0B and 0x0C",
73  {
74    "input": "text/html;charset=\u000Bgbk",
75    "output": "text/html",
76    "navigable": true,
77    "encoding": null
78  },
79  {
80    "input": "text/html;charset=\u000Cgbk",
81    "output": "text/html",
82    "navigable": true,
83    "encoding": null
84  },
85  {
86    "input": "text/html;\u000Bcharset=gbk",
87    "output": "text/html",
88    "navigable": true,
89    "encoding": null
90  },
91  {
92    "input": "text/html;\u000Ccharset=gbk",
93    "output": "text/html",
94    "navigable": true,
95    "encoding": null
96  },
97  "Single quotes are a token, not a delimiter",
98  {
99    "input": "text/html;charset='gbk'",
100    "output": "text/html;charset='gbk'",
101    "navigable": true,
102    "encoding": null
103  },
104  {
105    "input": "text/html;charset='gbk",
106    "output": "text/html;charset='gbk",
107    "navigable": true,
108    "encoding": null
109  },
110  {
111    "input": "text/html;charset=gbk'",
112    "output": "text/html;charset=gbk'",
113    "navigable": true,
114    "encoding": null
115  },
116  {
117    "input": "text/html;charset=';charset=GBK",
118    "output": "text/html;charset='",
119    "navigable": true,
120    "encoding": null
121  },
122  "Invalid parameters",
123  {
124    "input": "text/html;test;charset=gbk",
125    "output": "text/html;charset=gbk",
126    "navigable": true,
127    "encoding": "GBK"
128  },
129  {
130    "input": "text/html;test=;charset=gbk",
131    "output": "text/html;charset=gbk",
132    "navigable": true,
133    "encoding": "GBK"
134  },
135  {
136    "input": "text/html;';charset=gbk",
137    "output": "text/html;charset=gbk",
138    "navigable": true,
139    "encoding": "GBK"
140  },
141  {
142    "input": "text/html;\";charset=gbk",
143    "output": "text/html;charset=gbk",
144    "navigable": true,
145    "encoding": "GBK"
146  },
147  {
148    "input": "text/html ; ; charset=gbk",
149    "output": "text/html;charset=gbk",
150    "navigable": true,
151    "encoding": "GBK"
152  },
153  {
154    "input": "text/html;;;;charset=gbk",
155    "output": "text/html;charset=gbk",
156    "navigable": true,
157    "encoding": "GBK"
158  },
159  {
160    "input": "text/html;charset= \"\u007F;charset=GBK",
161    "output": "text/html;charset=GBK",
162    "navigable": true,
163    "encoding": "GBK"
164  },
165  {
166    "input": "text/html;charset=\"\u007F;charset=foo\";charset=GBK",
167    "output": "text/html;charset=GBK",
168    "navigable": true,
169    "encoding": "GBK"
170  },
171  "Double quotes",
172  {
173    "input": "text/html;charset=\"gbk\"",
174    "output": "text/html;charset=gbk",
175    "navigable": true,
176    "encoding": "GBK"
177  },
178  {
179    "input": "text/html;charset=\"gbk",
180    "output": "text/html;charset=gbk",
181    "navigable": true,
182    "encoding": "GBK"
183  },
184  {
185    "input": "text/html;charset=gbk\"",
186    "output": "text/html;charset=\"gbk\\\"\"",
187    "navigable": true,
188    "encoding": null
189  },
190  {
191    "input": "text/html;charset=\" gbk\"",
192    "output": "text/html;charset=\" gbk\"",
193    "navigable": true,
194    "encoding": "GBK"
195  },
196  {
197    "input": "text/html;charset=\"gbk \"",
198    "output": "text/html;charset=\"gbk \"",
199    "navigable": true,
200    "encoding": "GBK"
201  },
202  {
203    "input": "text/html;charset=\"\\ gbk\"",
204    "output": "text/html;charset=\" gbk\"",
205    "navigable": true,
206    "encoding": "GBK"
207  },
208  {
209    "input": "text/html;charset=\"\\g\\b\\k\"",
210    "output": "text/html;charset=gbk",
211    "navigable": true,
212    "encoding": "GBK"
213  },
214  {
215    "input": "text/html;charset=\"gbk\"x",
216    "output": "text/html;charset=gbk",
217    "navigable": true,
218    "encoding": "GBK"
219  },
220  {
221    "input": "text/html;charset=\"\";charset=GBK",
222    "output": "text/html;charset=\"\"",
223    "navigable": true,
224    "encoding": null
225  },
226  {
227    "input": "text/html;charset=\";charset=GBK",
228    "output": "text/html;charset=\";charset=GBK\"",
229    "navigable": true,
230    "encoding": null
231  },
232  "Unexpected code points",
233  {
234    "input": "text/html;charset={gbk}",
235    "output": "text/html;charset=\"{gbk}\"",
236    "navigable": true,
237    "encoding": null
238  },
239  "Parameter name longer than 127",
240  {
241    "input": "text/html;0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789=x;charset=gbk",
242    "output": "text/html;0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789=x;charset=gbk",
243    "navigable": true,
244    "encoding": "GBK"
245  },
246  "type/subtype longer than 127",
247  {
248    "input": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
249    "output": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
250  },
251  "Valid",
252  {
253    "input": "!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
254    "output": "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
255  },
256  {
257    "input": "x/x;x=\"\t !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF\"",
258    "output": "x/x;x=\"\t !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF\""
259  },
260  "End-of-file handling",
261  {
262    "input": "x/x;test",
263    "output": "x/x"
264  },
265  {
266    "input": "x/x;test=\"\\",
267    "output": "x/x;test=\"\\\\\""
268  },
269  "Whitespace (not handled by generated-mime-types.json or above)",
270  {
271    "input": "x/x;x= ",
272    "output": "x/x"
273  },
274  {
275    "input": "x/x;x=\t",
276    "output": "x/x"
277  },
278  {
279    "input": "x/x\n\r\t ;x=x",
280    "output": "x/x;x=x"
281  },
282  {
283    "input": "\n\r\t x/x;x=x\n\r\t ",
284    "output": "x/x;x=x"
285  },
286  {
287    "input": "x/x;\n\r\t x=x\n\r\t ;x=y",
288    "output": "x/x;x=x"
289  },
290  "Latin1",
291  {
292    "input": "text/html;test=\u00FF;charset=gbk",
293    "output": "text/html;test=\"\u00FF\";charset=gbk",
294    "navigable": true,
295    "encoding": "GBK"
296  },
297  ">Latin1",
298  {
299    "input": "x/x;test=\uFFFD;x=x",
300    "output": "x/x;x=x"
301  },
302  "Failure",
303  {
304    "input": "\u000Bx/x",
305    "output": null
306  },
307  {
308    "input": "\u000Cx/x",
309    "output": null
310  },
311  {
312    "input": "x/x\u000B",
313    "output": null
314  },
315  {
316    "input": "x/x\u000C",
317    "output": null
318  },
319  {
320    "input": "",
321    "output": null
322  },
323  {
324    "input": "\t",
325    "output": null
326  },
327  {
328    "input": "/",
329    "output": null
330  },
331  {
332    "input": "bogus",
333    "output": null
334  },
335  {
336    "input": "bogus/",
337    "output": null
338  },
339  {
340    "input": "bogus/ ",
341    "output": null
342  },
343  {
344    "input": "bogus/bogus/;",
345    "output": null
346  },
347  {
348    "input": "</>",
349    "output": null
350  },
351  {
352    "input": "(/)",
353    "output": null
354  },
355  {
356    "input": "ÿ/ÿ",
357    "output": null
358  },
359  {
360    "input": "text/html(;doesnot=matter",
361    "output": null
362  },
363  {
364    "input": "{/}",
365    "output": null
366  },
367  {
368    "input": "\u0100/\u0100",
369    "output": null
370  },
371  {
372    "input": "text /html",
373    "output": null
374  },
375  {
376    "input": "text/ html",
377    "output": null
378  },
379  {
380    "input": "\"text/html\"",
381    "output": null
382  }
383]
384