ZF-7722: HTML 5 support for the new meta type "charset" in Zend_View_Helper_HeadMeta

Description

HTML 5 introduces support for the "charset" meta tag to replace the HTML 4 http-equiv "Content-Type". Support for this is not possible with Zend_View_Helper_HeadMeta (that I can tell). It can be introduced by adding a new setCharset() method for the helper and introducing some changes to enforce that a content attribute is not required so long as a) the doctype is HTML5 and b) its a meta element of type "charset". Additionally, HTML 5 drops support for the "scheme" attribute (passed as modifiers in many methods).

Adding at least the charset meta support is not a huge problem. See the attached patch in the next comment. It would be great to see HTML 5 support in other areas make it into Zend_View and Zend_Form (e.g. the new input types). If there's a need for some help here, let me know. I've marked this issue as a minor new feature - if another category is more appropriate feel free to edit. HTML 5 support overall would be major in my opinion ;).

Comments

Patch to introduce support for the HTML 5 charset meta element.

Usage:

$helper->setCharset('utf-8');

Output:

The patch can be further modified to also add a condition detecting a XHTML5 doctype (same as HTML5 except it prefers closing all tags as per typical XHTML practice, and any other XHTML behaviour still supported by an XHTML serialisation of HTML5). I've linked to the issue in question.

adds a patch quite similar to padraic's, but moves html5 checking back to the doctype via an isHtml5() method (just like isXhtml()). includes documentation and unit tests for everything :)

Patch applied in trunk, and will release with 1.10 -- thanks!