feat: convert xml to utf-8

This commit is contained in:
eneko committed 2026-01-22 19:47:29 +01:00
1 parent 06ef233bcc
commit 01fb0aedf5
2 files changed
+8 -5

No files matched your search

+5 -2
View File
@@ -18,10 +18,13 @@ export default async ({ req, res, log, error }: any) => {
throw new Error(`Error! status: ${response.status}`);
}
const decoder = new TextDecoder('iso-8859-15');
let xml = decoder.decode(await response.arrayBuffer())
const parser = new XMLParser();
let json = parser.parse(await response.text());
let json = parser.parse(xml);
log(json)
return res.json({sucess: false, data: json})
return res.json({sucess: true, data: json})
} catch(err: any) {
error("Error fetching forecast: " + err.message);