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

129
Views
Current state of the art for UTF-8 handling in a browser making an external post

I have an application with a browser page that allows upload of CSV to Google Drive via V2 of the api. It is only handling ASCII (I get "failed to execute btoa / string to be encoded contains characters outside the Latin1 range").

I've updated my code so that the content-type is now "text/csv;charset=UTF-8;". I am still using content-transfer-encoding of base64.

In multiple places on the web, I found recommendations of using btoa(unescape(encodeURIComponent(data))). Previously, the code was only doing btoa(data). It seems to work, though I have not tested it exhaustively.

I understand that unescape is considered in a precarious light relative to ECMA-262. Here are the questions:

  • a) does the above work for all of UTF-8 (including 4-byte chars)?
  • b) if not, will it just fail to encode properly, or will I get a browser error?
  • c) are there any other risks of using this approach (even if it handles 4-byte chars)?
  • d) is there a better / newer way of doing this? I probably have the luxury of not supporting older browsers.
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!