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 "Spaces", 36 { 37 "input": "text/html;charset =gbk", 38 "output": "text/html", 39 "navigable": true, 40 "encoding": null 41 }, 42 { 43 "input": "text/html ;charset=gbk", 44 "output": "text/html;charset=gbk", 45 "navigable": true, 46 "encoding": "GBK" 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 "Single quotes are a token, not a delimiter", 61 { 62 "input": "text/html;charset='gbk'", 63 "output": "text/html;charset='gbk'", 64 "navigable": true, 65 "encoding": null 66 }, 67 { 68 "input": "text/html;charset='gbk", 69 "output": "text/html;charset='gbk", 70 "navigable": true, 71 "encoding": null 72 }, 73 { 74 "input": "text/html;charset=gbk'", 75 "output": "text/html;charset=gbk'", 76 "navigable": true, 77 "encoding": null 78 }, 79 "Invalid parameters", 80 { 81 "input": "text/html;test;charset=gbk", 82 "output": "text/html;charset=gbk", 83 "navigable": true, 84 "encoding": "GBK" 85 }, 86 { 87 "input": "text/html;test=;charset=gbk", 88 "output": "text/html;charset=gbk", 89 "navigable": true, 90 "encoding": "GBK" 91 }, 92 { 93 "input": "text/html;';charset=gbk", 94 "output": "text/html;charset=gbk", 95 "navigable": true, 96 "encoding": "GBK" 97 }, 98 { 99 "input": "text/html;\";charset=gbk", 100 "output": "text/html;charset=gbk", 101 "navigable": true, 102 "encoding": "GBK" 103 }, 104 { 105 "input": "text/html ; ; charset=gbk", 106 "output": "text/html;charset=gbk", 107 "navigable": true, 108 "encoding": "GBK" 109 }, 110 { 111 "input": "text/html;;;;charset=gbk", 112 "output": "text/html;charset=gbk", 113 "navigable": true, 114 "encoding": "GBK" 115 }, 116 "Double quotes", 117 { 118 "input": "text/html;charset=\"gbk\"", 119 "output": "text/html;charset=gbk", 120 "navigable": true, 121 "encoding": "GBK" 122 }, 123 { 124 "input": "text/html;charset=\"gbk", 125 "output": "text/html;charset=gbk", 126 "navigable": true, 127 "encoding": "GBK" 128 }, 129 { 130 "input": "text/html;charset=gbk\"", 131 "output": "text/html;charset=\"gbk\\\"\"", 132 "navigable": true, 133 "encoding": null 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=\"\\g\\b\\k\"", 149 "output": "text/html;charset=gbk", 150 "navigable": true, 151 "encoding": "GBK" 152 }, 153 { 154 "input": "text/html;charset=\"gbk\"x", 155 "output": "text/html;charset=gbk", 156 "navigable": true, 157 "encoding": "GBK" 158 }, 159 "Unexpected code points", 160 { 161 "input": "text/html;charset={gbk}", 162 "output": "text/html;charset=\"{gbk}\"", 163 "navigable": true, 164 "encoding": null 165 }, 166 "Parameter name longer than 127", 167 { 168 "input": "text/html;0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789=x;charset=gbk", 169 "output": "text/html;0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789=x;charset=gbk", 170 "navigable": true, 171 "encoding": "GBK" 172 }, 173 "type/subtype longer than 127", 174 { 175 "input": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 176 "output": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" 177 }, 178 "Valid", 179 { 180 "input": "!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 181 "output": "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 182 }, 183 { 184 "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\"", 185 "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\"" 186 }, 187 "End-of-file handling", 188 { 189 "input": "x/x;test", 190 "output": "x/x" 191 }, 192 { 193 "input": "x/x;test=\"\\", 194 "output": "x/x;test=\"\\\\\"" 195 }, 196 "Whitespace (not handled by generated-mime-types.json or above)", 197 { 198 "input": "x/x;x= ", 199 "output": "x/x" 200 }, 201 { 202 "input": "x/x;x=\t", 203 "output": "x/x" 204 }, 205 "Latin1", 206 { 207 "input": "text/html;test=\u00FF;charset=gbk", 208 "output": "text/html;test=\"\u00FF\";charset=gbk", 209 "navigable": true, 210 "encoding": "GBK" 211 }, 212 ">Latin1", 213 { 214 "input": "x/x;test=\uFFFD;x=x", 215 "output": "x/x;x=x" 216 }, 217 "Failure", 218 { 219 "input": "", 220 "output": null 221 }, 222 { 223 "input": "\t", 224 "output": null 225 }, 226 { 227 "input": "bogus", 228 "output": null 229 }, 230 { 231 "input": "bogus/", 232 "output": null 233 }, 234 { 235 "input": "bogus/ ", 236 "output": null 237 }, 238 { 239 "input": "bogus/bogus/;", 240 "output": null 241 }, 242 { 243 "input": "</>", 244 "output": null 245 }, 246 { 247 "input": "(/)", 248 "output": null 249 }, 250 { 251 "input": "text/html(;doesnot=matter", 252 "output": null 253 }, 254 { 255 "input": "{/}", 256 "output": null 257 }, 258 { 259 "input": "\u0100/\u0100", 260 "output": null 261 } 262] 263