Docly Developers
Function Updated 30 May 2026

encodeFilename(filename)

Encode a filename by replacing characters not allowed in filenames with their ASCII code representations. Reverse function of decodeFilename.

Parameters

filenamestringrequired

Filename to encode special chars.

Returns

An encoded filename where symbols not allowed in filenames are replaced with their ASCII code representations.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
let encodedFilename = docly.encodeFilename(query.file1);