Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> There is no reason to store encoding information in an html file.

That's simply wrong. If you use libraries like D3.js, that contain non-ASCII characters in the source code, and you do local development with a server that sends no encoding headers or even without using a server at all, your code won't work.



That is, as far as I know, not true.

If your file is in html5, then all browsers will assume a default encoding of utf-8, which is what you should be using anyway - unless you have a very good reason, such as your file contains a majority of kanji or kana.

If you're using something older, the official defaut is iso latin 1, but I believe all modern browsers will try utf-8 first - this is not something I've verified for myself, it works on my setup but I also configured my os to use a default utf-8 encoding, so I can't tell for sure.

I'm also unclear how this relates to d3.js - that's a javascript import, not an html one. Or do you mean inline javascript that uses d3.js?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: