Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

279
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda