Namespace: utf8

util. utf8

A minimal UTF8 implementation for number arrays.

Methods

util.utf8.length(string){ number }

Calculates the UTF8 byte length of a string.

Name Type Description
string string

String

Returns:
Type Description
number Byte length

util.utf8.read(buffer, start, end){ string }

Reads UTF8 bytes as a string.

Name Type Description
buffer Uint8Array

Source buffer

start number

Source start

end number

Source end

Returns:
Type Description
string String read

util.utf8.write(string, buffer, offset){ number }

Writes a string as UTF8 bytes.

Name Type Description
string string

Source string

buffer Uint8Array

Destination buffer

offset number

Destination offset

Returns:
Type Description
number Bytes written