new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Cloudflare Workers · Runtime APIs · all subjects

encoding

11 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

TextEncoder constructor

TextEncoder() returns a newly constructed TextEncoder that generates a byte stream with UTF-8 encoding. TextEncoder takes no parameters and throws no exceptions. Encoding types passed to the constructor are ignored and a UTF-8 TextEncoder is created.

TextEncoder encoding property

The encoder.encoding property is a read-only DOMString that returns the name of the encoder as a string describing the method the TextEncoder uses. It always returns 'utf-8'.

TextEncoder encode method

The encode(inputUSVString) method takes a string input and returns a Uint8Array of the encoded bytes.

TextEncoder example

Example of creating a TextEncoder: let encoder = new TextEncoder();

TextDecoder constructor

TextDecoder() returns a newly constructed TextDecoder that generates a code-point stream with UTF-8 decoding.

TextDecoder encoding property

The decoder.encoding property is a read-only DOMString that returns the name of the decoder describing the method the TextDecoder uses.

TextDecoder fatal property

The decoder.fatal property is a read-only boolean that indicates if the error mode is fatal.

TextDecoder ignoreBOM property

The decoder.ignoreBOM property is a read-only boolean that indicates if the byte-order marker is ignored.

TextDecoder decode method

The decode() method decodes using the method specified in the TextDecoder object and returns a DOMString.

TextDecoder example

Example of creating a TextDecoder: let decoder = new TextDecoder();

TextEncoder and TextDecoder support UTF-8

Both TextEncoder and TextDecoder support UTF-8 encoding and decoding. The TextEncoderStream and TextDecoderStream classes are also available.

Give your agent this brain