The terms character set (here: charset) and character encoding (here:
encoding) were historically synonymous. The terms now have related but
distinct meanings. Whenever possible Lithium tries to use precise
terminology. Since HTML uses the term charset we expose this method
under the exact same name. This caters to the expectation towards a HTML
helper. However the rest of the framework will use the term encoding
when talking about character encoding.
It is suggested that uppercase letters should be used when specifying
the encoding. HTML specs don't require it to be uppercase and sites in
the wild most often use the lowercase variant. On the other hand must
XML parsers (those may not be relevant in this context anyway) not
support lowercase encodings. This and the fact that IANA lists only
encodings with uppercase characters led to the above suggestion.
public charset ( string $encoding = null ) : string | ||
$encoding | string | The character encoding to be used in the meta tag. Defaults to the encoding of the `Response` object attached to the current context. The default encoding of that object is `UTF-8`. The string given here is not manipulated in any way, so that values are rendered literally. Also see above note about casing. |
return | string | A meta tag containing the specified encoding (literally). |