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

283
Views
How can I read ch-zh, ru, ja character in csv?

I draft a code to generate i18n.csv

const fs = require("fs")

async function main() {
  let table = [ 
    [ "en", "ch-zh", 'ru', 'ja' ],
    [ "Hello", "你好", "Привет", "こんにちは" ]
  ]

  fs.writeFileSync(__dirname +"/i18n.csv", array2csv(table), { encoding: "utf8", flag: 'a', mode: 0o666 })
}
main()

function array2csv(arr){
  arr = arr.map((col) => { return col.join(",") })
  arr = arr.join("\n")
  return arr
}

And I got the result as my expected in the file:

en,ch-zh,ru,ja
Hello,你好,Привет,こんにちは

But I cannot see the data if the characters are not a english character in excel, how can I fix it?

enter image description here

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

0

Thanks all guys for the helps, it works now!

[Summary] Prepend a UTF-8 BOM in the csv file

const fs = require("fs")

async function main() {
  let table = [ 
    [ "en", "ch-zh", 'ru', 'ja', 'emoji' ],
    [ "Hello", "你好", "Привет", "こんにちは", '✅' ]
  ]

  fs.writeFileSync(__dirname +"/i18n.csv", array2csv(table), { encoding: "utf8", flag: 'a', mode: 0o666 })
}
main()

function array2csv(arr){
  arr = arr.map((col) => { return "\ufeff" + col.join(",") })
  arr = arr.join("\n")
  return arr
}

enter image description here

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!