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

UTF-8 Byte Order Mark (  ) #47

Closed
jonaldinger opened this issue May 6, 2011 · 3 comments
Closed

UTF-8 Byte Order Mark (  ) #47

jonaldinger opened this issue May 6, 2011 · 3 comments

Comments

@jonaldinger
Copy link

This character sequence was showing up in one of my asset-compressed CSS files:

/* asset_compress 1304690655 */
body{margin:0;padding:0}

I thought this was a regex parsing issue, so I tried turning off comment removal, manually removing the comments from my source file, and finally tried including a single css file with a single rule and no comments. I tried CssMin. I tried YUI compressor. The characters were still showing up and causing rendering issues on the front-end. I wound up googling for this character sequence, and learned that it is actually the UTF-8 Byte Order Mark, and it can show up when parsers treat file contents as a string. I don't know if there is an easy programmatic fix for this issue, but for anyone else having this issue, I was able to work around it by creating a new file in TextMate and pasting in the contents of my initial file. I'm guessing it was a character-encoding issue, but am not totally sure.

@Phally
Copy link
Contributor

Phally commented May 6, 2011

I think the BOM was (is) in your own source file. You can also fix this by converting your source file to UTF-8 without BOM. Not sure if TextMate has that option (i am not using that). I don't think this is a bug in AssetCompress.

@markstory
Copy link
Owner

AssetCompress doesn't add BOM to any files. It just processes what is there. And if various compressors all end up with the marks being there, perhaps they are in the file?

@jonaldinger
Copy link
Author

The BOM is not visible in my source file, and does not show up in any of my uncompressed files when viewing in the browser, but as you both mentioned the file encoding is likely set to UTF-8 with BOM. I had tried converting to UTF-8 without BOM in TextMate, but couldn't find the option. I figured at a minimum, if somebody else has this issue they will at least be able to find this discussion; if you think it's appropriate, I could add a note about the BOM in the Wiki for future unsuspecting users. Thanks for the quick feedback!

P.S. after some further research, it seems as though Visual Studio likes to create UTF-8 with BOM. I had grabbed my reset CSS file from a recent .NET project, so that's likely how the encoding got set in the first place.

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

No branches or pull requests

3 participants