0

I'm trying to parse XML file in Node with xml2js library.

The issue is that the file encoding is windows-1250 instead of utf-8.

So when I try to get the values it contains wrong characters. For example, instead of ř I get Ĺ™.

How can I convert the xml file or the string values to utf-8 in Node?

froston
  • 1,027
  • 1
  • 12
  • 24
  • You've given a URL to the XML document, yet you refer to a file. Is the process that downloads the document and stores it preserving the bytes? Is there code to show ([edit]) for that? – Tom Blodget Feb 01 '19 at 23:30

1 Answers1

1

You can try util.TextDecoder, but you will need full ICU for this (see details how to check or get it).

Alternatively, you can try npm modules like iconv-lite.

vsemozhebuty
  • 12,992
  • 1
  • 26
  • 26