4 ms·
> Do not use entity references That's surprising. They've saved me many times when files are opened and re-saved in different editors, from losing an accent or
by crazygringo 15y ago
> Do not use entity references
That's surprising. They've saved me many times when files are opened and re-saved in different editors, from losing an accent or an em-dash halfway down the page where it's rarely noticed...
- ajross 15y agoThey save bytes. And as long as the UTF-8 rule is followed everything works fine. Also: editors that munge encodings without warning are evil.
- crazygringo 15y agoThe bytes are completely trivial, unless your entire document is a non-latin script. And my point is that the UTF-8 rule is not always followed, because source code gets passed around via e-mail, copied from browsers, edited in a console, saved with Notepad, and so on. Ideally file content would only ever be touched by source code editors configured only to ever operate in UTF-8 mode, but in the real world with real development teams and new interns, that is an impossible thing to ask. At my last job, I made sure all accented characters in source code were only ever written with entity references, and we went from having weekly problems with accents somewhere on the site, to almost never.
- ajross 15y agoIf that describes your development process, you have problems that entities won't correct. I think you maybe misunderstand the audience here: these are guidelines for Google's engineers. Honestly I think demanding (and assuming) that your developers use a toolchain that doesn't suck is a reasonable choice in that environment. It may not be in all shops.
- crazygringo 15y agoYeah, we worked a lot with outsourced development as well, and obviously didn't have any control over what tools they used...
- harisenbon 15y agoOr even in some cases causing the encoding gremlins to get in. I always have major problems with pretty quotes breaking when copying from GoogleDocs to Netbeans. "That's how" becomes "That’s how"
- isleyaardvark 15y agoAnd what about &'s in query strings?