get_decoder Function

Defined in pyglet.text

get_decoder(filename, mimetype=None)

Get a document decoder for the given filename and MIME type.

If mimetype is omitted it is guessed from the filename extension.

The following MIME types are supported:

text/plain
Plain text
text/html
HTML 4 Transitional
text/vnd.pyglet-attributed
Attributed text; see pyglet.text.formats.attributed

DocumentDecodeException is raised if another MIME type is given.

Parameters:
  • filename (str) – Filename to guess the MIME type from. If a MIME type is given, the filename is ignored.
  • mimetype (str) – MIME type to lookup, or None to guess the type from the filename.
Return type:

DocumentDecoder

Previous topic

decode_text Function

Next topic

load Function