NYCPHP Meetup

NYPHP.org

[nycphp-talk] UTF-8, databases and best practices

Hans Zaunere bulk at zaunere.com
Wed May 23 15:32:47 EDT 2012


> Yes about point 4: save your PHP file in UTF-8 and add the encoding to
> your HTML
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
>
> obvious things that can make you lose hours of deugging

This actually brings up a good point/question that I've had.

I commonly use HTML 5 boilerplate, and they too have a similar meta tag as
above to set the charset.

However, while developing along one day, I was seeing an erroneous request
hitting the web server (from Firefox).  After much debugging and bug
searching, I arrived at commenting it out and leaving this note:

/*
This causes problem with Firefox (double requests) if output comes
before the doctype.  Use PHP to set the Content-Type and charset,
not a meta tag.
<meta charset="utf-8">
*/

So obviously having output before doctype isn't what's supposed to happen,
though it does, and when it does and Firefox suddenly makes double requests
for no reason, it's really difficult to pin down.  Anyone else see anything
like this?

H





More information about the talk mailing list