-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to override UTF-8 BOM stripping #72
Comments
@sindresorhus any comment? |
@IsaacSanch Will get this resolved 👍 |
Oops meant to ping @mathiasbynens |
The BOM in UTF-8 has no meaning.
It's normal to remove the BOM as it conflicts with many things, like JSON.parse, etc. You should just get in the habit of assuming it's getting stripped. Even Node does this when you
👎 Just add it back if you need it. There really shouldn't be a flag for something like this. |
Adding my comment from the commit here for visibility - @sindresorhus Not adding it just because it was asked for, adding it because it makes sense. We shouldn't be fucking with contents without a way to disable it or we are a really shitty general purpose fs access tool (vinyl-fs) |
@contra The strip BOM functionality is fixing a bug for users. UTF-8 shouldn't have a BOM. Now every gulp plugin will have to handle BOM stripping in case |
👍 with @sindresorhus here - we should always remove when encoding is |
If this is an opinionated view we want to take on reading files then it needs to be documented |
Resolution: Use something prior to .dest to add the BOM back to your files if you encounter this edge-case. https://www.npmjs.com/package/vinyl-map is a good place to start 👍 When you come up with working code please post it here so others can see it. |
Probably just create the inverse of https://www.npmjs.com/package/gulp-stripbom |
@phated Yup, was going to suggest that. |
Locking since this is resolved 👍 |
Having been working with gulp (and vinyl-fs by proxy) for a while now, I have become aware that vinyl-fs strips the BOM from UTF-8 files. This is currently completely undocumented (except a footnote in the changelog) and yet potentially effects any system that needs to have BOM present in output files. (IIS / ASP.NET is an example that can occasionally be picky with the output of UTF8 files that lack BOM.) Providing users with a flag to override this behavior would be helpful for these edge cases.
The text was updated successfully, but these errors were encountered: