diff --git a/src/ssn/getManifest.ts b/src/ssn/getManifest.ts index e0e1abb..df5b3b2 100644 --- a/src/ssn/getManifest.ts +++ b/src/ssn/getManifest.ts @@ -38,7 +38,7 @@ export default async function getManifest(product: Product): Promise const patchmanifestStream = extractFileStream(firstFile, stream); //Convert ArrayBuffer to string - const patchmanifestXml = await streamToString(patchmanifestStream); + const patchmanifestXml = await streamToString(patchmanifestStream, 'utf-16le'); //convert XML to JSON-converted XML const patchManifestJson = xmlJs.xml2js(patchmanifestXml) as xmlJs.Element; diff --git a/src/ssn/streams/streamToString.ts b/src/ssn/streams/streamToString.ts index 97cf953..1260e35 100644 --- a/src/ssn/streams/streamToString.ts +++ b/src/ssn/streams/streamToString.ts @@ -1,8 +1,8 @@ import * as stream from 'stream'; import { TextDecoder } from 'util'; -export default function streamToString(inputStream: stream.Readable): Promise { - const decoder = new TextDecoder('utf-8'); +export default function streamToString(inputStream: stream.Readable, encoding: string = 'utf-8'): Promise { + const decoder = new TextDecoder(encoding); //utf-8 or utf-16le return new Promise((resolve, reject) => { const stringParts: string[] = [];