(value: string)
| 1375 | } |
| 1376 | |
| 1377 | function serializeDisplayString(value: string): string { |
| 1378 | const bytes = UTF8_ENCODER.encode(value); |
| 1379 | |
| 1380 | let result = '%"'; |
| 1381 | for (const byte of bytes) { |
| 1382 | if (byte === 0x25) { |
| 1383 | // % -> %25 |
| 1384 | result += "%25"; |
| 1385 | } else if (byte === 0x22) { |
| 1386 | // " -> %22 |
| 1387 | result += "%22"; |
| 1388 | } else if (byte >= 0x20 && byte <= 0x7e) { |
| 1389 | // Printable ASCII |
| 1390 | result += String.fromCharCode(byte); |
| 1391 | } else { |
| 1392 | // Percent-encode non-ASCII |
| 1393 | result += "%" + byte.toString(16).padStart(2, "0"); |
| 1394 | } |
| 1395 | } |
| 1396 | result += '"'; |
| 1397 | |
| 1398 | return result; |
| 1399 | } |
| 1400 | |
| 1401 | function serializeParameters(parameters: Parameters): string { |
| 1402 | let result = ""; |
no test coverage detected