Skip to content

Commit

Permalink
Data URI: escape space characters as defined as excluded character in…
Browse files Browse the repository at this point in the history
… RFC2396
  • Loading branch information
tdewolff committed Apr 5, 2022
1 parent c6eaa39 commit 7054e8c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,17 @@ var URLEncodingTable = [256]bool{
}

// DataURIEncodingTable is a charmap for which characters need escaping in the Data URI encoding scheme
// Escape only non-printable characters, unicode and %, #, &. IE11 additionally requires encoding of
// \, [, ], ", <, >, `, {, }, |, ^ which is not required by Chrome, Firefox, Opera, Edge, Safari, Yandex
// Escape only non-printable characters, unicode and %, #, &.
// IE11 additionally requires encoding of \, [, ], ", <, >, `, {, }, |, ^ which is not required by Chrome, Firefox, Opera, Edge, Safari, Yandex
// To pass the HTML validator, restricted URL characters must be escaped: non-printable characters, space, <, >, #, %, "
var DataURIEncodingTable = [256]bool{
// ASCII
true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true,

false, false, true, true, false, true, true, false, // ", #, %, &
true, false, true, true, false, true, true, false, // space, ", #, %, &
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, true, false, true, false, // <, >
Expand Down

0 comments on commit 7054e8c

Please sign in to comment.