Which isn't suprising unless VS would store the last applied character
encoding for each file -- which wouldn't hurt ;-)
The project file can be a great place to store that kind of info.
But, the fact still remains: VS is not a creation HTML tools.
I like it, is very strong, can do a decent job for a lot of file formats,
bat I would not push it too much
And in fact, MS does not do it either,
this is whay they have dedicated html tools
There's nothing non-standard about UTF-8 with a BOM. The only thing you
might
want to avoid is saving a pure HTML file with a BOM, because some (older)
browsers happily include the BOM in the rendered text :-/
When in doubt, I go to the standard
I have no opinion on UTF-8 + BOM in general, but I do have opinions on
UTF-8 + BOM in the context of various file formats.
For some formats is good, for some is not only bad, but non-standard.
One of the good documents is this:
http://unicode.org/unicode/faq/utf_bom.html#BOM
<<Where the precise type of the data stream is known, the BOM should not be
used.>>
In general, Unicode consistently tries to leave decisions to higher-levels
protocols.
There are clear standard methods to identify the encoding of an HTML page,
both as stand-alone file, and as served over HTTP. There is no need for
another one.
And both the HTML and XML (implying XHTML) standards have clear ways to
determine the encoding.
The fact that some browsers handle it properly does not mean is standard.
Fast, from the top of your head, who is the winner here:
- the http header from the server (determined by the server's config) says
Content-Type: text/html; charset=ISO-8859-1
- the html file has a Content-Type in the head section
<META http-equiv="Content-Type" content="text/html; charset=EUC-JP">
- the html file has a UTF-8 BOM at the very beginning (EF BB BF)
- the content itself is in fact Shift-JIS
If you got the winner right, then why (according to what standard)?
But for a compilation unit such as .aspx or .cs, there should be no problem
using a BOM. In this case, the build tool (page translator, compiler, etc.)
deals with it.
The buildtime encoding doesn't need to match the runtime encoding
anyway[*], and using UTF-8 as runtime encoding shouldn't procude a BOM in
the output stream, unless you really ask for it.
Agree. Although these days mixing encodings is just a way to ask for trouble,
or show off (look how cool I am, you can master such a mess
There is no reason to be anything other than Unicode. Ten years ago, yes.
Now there are still some exceptions, but fewer and fewer.