encodeFilename(filename) Last updated: 30. May 2026

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

Parameters

Name Type Description
filename string

Filename to encode special chars.

Returns

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

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
let encodedFilename = docly.encodeFilename(query.file1);