API / Minn\Feed / Charset

Charset final class

Minn\Feed\Charset · public/minn/src/Minn/Feed/Charset.php · 45 lines

A feed document as UTF-8. The encoding comes from a byte-order mark, then the XML declaration, then the Content-Type charset, then UTF-8; a document in another encoding is converted and its declaration rewritten, so the parser only ever reads UTF-8.

Used by 1

Public

statictoUtf8(string $body, string $contentType = ''): string#

The document converted to UTF-8, with no byte-order mark.

staticdeclared(string $body): ?string#

The encoding the XML declaration names, if it names one.

Internals 2

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatefromContentType(string $contentType): ?string#
privateconvert(string $body, string $encoding): string#