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

143
Views
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
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!