Skip to content

Unicode filenames need to be decoded. #252

Closed
@JakeCigar

Description

@JakeCigar

Chrome and Firefox "entity encode" unicode file names. Safari does not.

Chrome:"JΛ̊KE_2023-02-25T16:44:24.129Z.avif"
Safari: "JΛ̊KE_2023-02-25T16:44:24.129Z.avif"

( I had to change & to "& amp ;" on the Chrome file name to show the problem)

My workaround is:

form.on("file",(_,file)=>file.originalFilename=parseHtmlEntities(file.originalFilename));
function parseHtmlEntities(str) {
    return str
        .replace(/&#([0-9]{1,5});/g,     (m,d)=>String.fromCharCode( parseInt(d,10)))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions