Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
Javascript posting form with new line and unicode characters

I would appreciate some help with this. I am using Javascript to create a form element on the fly which contains a text input, assign a string to it's value and then submit it to a WEB API method which will accept a FormDataCollection. I am not using JQuery or any other library, I need to post it this way, since the API will return a file and this method was the only one that prompted user to open the file. It works, however new line characters are removed from the file(I also used textarea it didn't help), and also unicode characters are not displayed correctly (for example I get fianc� when input is fiancé (I tried setting the char set to UAT-8, didn't help either), this is the code, thanks a lot for your time!

     var mapForm = document.createElement("form");
mapForm.character_set = "utf-8";
            mapForm.target ="_self"||"_blank";
            mapForm.id="stmtForm";
            mapForm.method = "POST";
            mapForm.action = "http://blahblahblah;          
            var mapInput = document.createElement("input");
            mapInput.type = "Textarea";
            mapInput.name = "psResult";
            mapInput.value = psResult;
            mapForm.appendChild(mapInput);
            document.body.appendChild(mapForm);
    
            mapForm.submit();
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda