Commit 73bfdaa1 authored by nanahira's avatar nanahira

fix encoding

parent 2589090e
Pipeline #198 failed with stages
in 41 seconds
......@@ -8,7 +8,13 @@ const gzip: (b: Buffer) => Promise<Buffer> = util.promisify(zlib.gzip);
const gunzip: (b: Buffer) => Promise<Buffer> = util.promisify(zlib.gunzip);
const xmlParser = new xml.Parser();
const xmlBuilder = new xml.Builder();
const xmlBuilder = new xml.Builder({
xmldec: {
version: '1.0',
encoding: 'utf-16',
standalone: false
}
});
const baseLocation: string = process.env.BASE_LOCATION;
const baseLocationAccessProtocols: string = process.env.PROTOCOL || "HTTP";
......@@ -25,9 +31,9 @@ app.use('/', proxy("https://downloads.dell.com,", {
xmlObject.Manifest.$.baseLocation = baseLocation;
xmlObject.Manifest.$.baseLocationAccessProtocols = baseLocationAccessProtocols;
const replaceContent = xmlBuilder.buildObject(xmlObject);
return await gzip(Buffer.from(replaceContent, "utf-8"));
return await gzip(iconv.encode(replaceContent, "utf16"));
}
return proxyResData;
}
}));
app.listen(80);
app.listen(8080);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment