@@ -438,21 +438,33 @@ test "Mime: parse charset" {
438438
439439 try expect (.{
440440 .content_type = .{ .text_xml = {} },
441- .charset = "UTF -8" ,
441+ .charset = "utf -8" ,
442442 .params = "charset=utf-8" ,
443443 }, "text/xml; charset=utf-8" );
444444
445445 try expect (.{
446446 .content_type = .{ .text_xml = {} },
447- .charset = "UTF -8" ,
447+ .charset = "utf -8" ,
448448 .params = "charset=\" utf-8\" " ,
449- }, "text/xml;charset=\" utf-8\" " );
449+ }, "text/xml;charset=\" UTF-8\" " );
450+
451+ try expect (.{
452+ .content_type = .{ .text_html = {} },
453+ .charset = "iso-8859-1" ,
454+ .params = "charset=\" iso-8859-1\" " ,
455+ }, "text/html; charset=\" iso-8859-1\" " );
456+
457+ try expect (.{
458+ .content_type = .{ .text_html = {} },
459+ .charset = "iso-8859-1" ,
460+ .params = "charset=\" iso-8859-1\" " ,
461+ }, "text/html; charset=\" ISO-8859-1\" " );
450462
451463 try expect (.{
452464 .content_type = .{ .text_xml = {} },
453- .charset = "lightpanda:UNSUPPORTED " ,
454- .params = "charset=\" \\\\ \\ \" \" " ,
455- }, "text/xml;charset=\" \\\\ \\ \" \" " );
465+ .charset = "custom-non-standard-charset-value " ,
466+ .params = "charset=\" custom-non-standard-charset-value \" " ,
467+ }, "text/xml;charset=\" custom-non-standard-charset-value \" " );
456468}
457469
458470test "Mime: isHTML" {
@@ -565,8 +577,10 @@ fn expect(expected: Expectation, input: []const u8) !void {
565577 try testing .expectEqual (expected .params , actual .params );
566578
567579 if (expected .charset ) | ec | {
568- try testing .expectEqual (ec , actual .charset .? );
580+ // We remove the null characters for testing purposes here.
581+ try testing .expectEqual (ec , actual .charsetString ()[0.. ec .len ]);
569582 } else {
570- try testing .expectEqual (null , actual .charset );
583+ const m : Mime = .unknown ;
584+ try testing .expectEqual (m .charsetString (), actual .charsetString ());
571585 }
572586}
0 commit comments