Raghu
Raghu

Reputation: 1

Special character (Æ, Ø, ø, Å, å, Ä, ä, Ö, ö) in downloaded word file getting formatted to ASCI values in javascript

I am downloading the macro enabled dotm file. This file is stored inside the server where the foreign characters are showing up fine, but when I download the same file through mu JS code to local its messing up the characters.URL is the file path I am passing here.

Example is NEERGÅRDSPARKEN to NEERG%C5RDSPARKEN and RØDOVRE to R%D8DOVRE.
url is where the macro enabled file path is passed.

const fileName = '1109801867_2024-02-01_15-24-22.dotm'; 
const anchor = document.createElement("a");

anchor.download = fileName;
anchor.href = url;
anchor.href = anchor.href.slice(5);

document.body.appendChild(anchor);

anchor.click();

document.body.removeChild(anchor);

JS triggered file download messes up accented characters is the path I found something (I got this example from another search which wont work here in my case as I am passing url in href.) where it does not help me here.

Upvotes: 0

Views: 66

Answers (0)

Related Questions