Skip to content
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

BOM is included in the compiled source. #661

Closed
petterek opened this issue Jun 23, 2017 · 9 comments
Closed

BOM is included in the compiled source. #661

petterek opened this issue Jun 23, 2017 · 9 comments
Labels

Comments

@petterek
Copy link

When using Visual Studio it saves the HTML with BOM as default, this add's the following first line in the

function create_main_fragment ( state, component ) {
	 var text_1_value, text_3_value;
     var text = createText( "´╗┐" ); //this is BOM

The BOM should be ignored

@Conduitry
Copy link
Member

I'm not sure whose responsibility this is. The Svelte compiler itself is passed a string, not bytes, and I think it should be able to expect the string to contain just the actual document.

What are you using to actual run Svelte? (Which build tool?) My understanding of how this stuff works is that whichever code is responsible for decoding bytes into strings isn't doing its job correctly.

@petterek
Copy link
Author

I am using the cli from PowerShell in Windows

@Conduitry
Copy link
Member

Looks like the CLI is always trying to interpret the input as UTF-8. (Aside - I think 'utf8' is what Node calls the encoding, and not 'utf-8'?) Not sure how to best handle this. I'm sure there are established libraries on npm for determining the encoding of a file but I don't have experience with them.

@petterek
Copy link
Author

petterek commented Jun 26, 2017

I have actually had the same 'issue' with json files, and "node contex" not able to handle them due to the BOM. Ended up with recoding the files, without BOM.
Unfortunately with BOM is the default in Visual Studio

@dinoboff
Copy link

dinoboff commented Jun 26, 2017

IMO, it's a bug with https://github.com/sveltejs/svelte-cli. Even if it assumes utf8 encoding, it should strip the BOM and maybe add it to the generated components.

See nodejs/node#3040

@Rich-Harris
Copy link
Member

Can you try [email protected] and see if it fixes this please?

@petterek
Copy link
Author

petterek commented Jul 5, 2017

Seems to fix the issue

@petterek petterek closed this as completed Jul 5, 2017
@petterek
Copy link
Author

petterek commented Jul 5, 2017

Great work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants