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

193
Views
Troubles trying to use Russian strings as values in a JSON variable using Javascript in a HTML page

In order to translate some values inside a big JSON (from Italian to Russian) and split it in smaller files, I've created an offline html + Javascript page, in order to to obtain a series of JSON files in a zip (using JSZip). But the Cyrillic strings are not displayed correctly.

The page starts from a JSON stored in a variable, iterates it in order to find certain keys, then reassign the related values with others values taken from an associative array like this:

var translations = {};
translations['Retro Armadio'] = 'Задняя сторона шкафа';
translations['Stagno'] = 'Водонепроницаемый';
translations['Zoccolo'] = 'Цоколь';

The page then stringify the JSON in order to display it in a "pre" Tag and generates the zip file with the splitted JSONs using JSZip:

var zip = new JSZip();
for (const key in bigJSON){
  var currentJSON = JSON.stringify(bigJSON[key]);
  var currentFileName = key + "-ru.json";
  zip.file(currentFileName, currentJSON);
}

Unfortunately both inside the "pre" tag and inside the zip file, the Cyrillic strings are corrupted. I also tried using encodeURIComponent/decodeURIComponent, but I obtain strings like this: "Ð›Ð¸Ñ†ÐµÐ²Ð°Ñ Ñторона шкафа"

To edit the HTML page I'm using Notepad++ in UTF-8. I copy and paste the Cyrillic strings from MS Excel.

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!