Skip to content

Commit

Permalink
Merge pull request #1 from napalu/bugfix/html_utf8_bom
Browse files Browse the repository at this point in the history
add html utf8 bom signature
  • Loading branch information
leaanthony authored Mar 31, 2022
2 parents ec41466 + 8ae06f3 commit 6df7e41
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/magic/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
var (
// HTML matches a Hypertext Markup Language file.
HTML = markup(
append([]byte{0xEF, 0xBB, 0xBF}, []byte("<!DOCTYPE HTML")...),
[]byte("<!DOCTYPE HTML"),
[]byte("<HTML"),
[]byte("<HEAD"),
Expand Down
1 change: 1 addition & 0 deletions mimetype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ var files = map[string]string{
"html.svg.html": "text/html; charset=utf-8",
"html.usascii.html": "text/html; charset=us-ascii",
"html.utf8.html": "text/html; charset=utf-8",
"html.utf8bom.html": "text/html; charset=utf-8",
"html.withbr.html": "text/html; charset=utf-8",
"ico.ico": "image/x-icon",
"ics.dos.ics": "text/calendar",
Expand Down
23 changes: 23 additions & 0 deletions testdata/html.utf8bom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<!--
Some comment
-->
<html dir="ltr" mozdisallowselectionprint>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="some name" content="notranslate">
<title>test</title>


<link rel="stylesheet" href="html.utf8bom.css">



</head>

<body tabindex="1">
<div id="printContainer"></div>
</body>
</html>

0 comments on commit 6df7e41

Please sign in to comment.