Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

278
Views
Encoding issue when saving files with javascript?

i've been trying all day to setup a function that creates a file from plaintext or a stream in a razor page. i create csv plaintext in a backend and send it to a frontend where i can save it to a file.

most of the things i have tried have worked perfectly so far, i can save what i get from my backend. but when i look at the file, the character 'ø' has been replaced with "ø". i have tried specifying utf-8 format and encoded it as html or base64 and plaintext and nothing seems to work.

function saveFile(name, type, data) {
   var a = $("<a style='display: none;'/>");
   var url = window.URL.createObjectURL(new Blob([data], { type: type }));
   a.attr("href", url);
   a.attr("download", name);
   $("body").append(a);
   a[0].click();
   window.URL.revokeObjectURL(url);
   a.remove();
}

is the way my code currently looks. any ideas? thank you

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It actually worked perfectly, I later realized excel was trying to read it with american text which doesn't contain æ ø å. opening it with notepad showed what i was expecting

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!