Skip to content

Commit f9a09b2

Browse files
committed
Expand BOM prepending to text/*
Now you can save HTML and rely on the auto-BOM prepender
1 parent 147cf92 commit f9a09b2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

FileSaver.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* FileSaver.js
22
* A saveAs() FileSaver implementation.
3-
* 2015-05-07
3+
* 2015-05-07.1
44
*
55
* By Eli Grey, http://eligrey.com
66
* License: X11/MIT
@@ -125,8 +125,8 @@ var saveAs = saveAs
125125
if (!name) {
126126
name = "download";
127127
}
128-
// prepend BOM for UTF-8 XML and text/plain types
129-
if (/^\s*(?:text\/(?:plain|xml)|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
128+
// prepend BOM for UTF-8 XML and text/* types (including HTML)
129+
if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
130130
blob = new Blob(["\ufeff", blob], {type: blob.type});
131131
}
132132
if (can_use_save_link) {

FileSaver.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)