Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
fix: use latin1 instead of utf8 for proper encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Feb 5, 2024
1 parent 31c695c commit 15557eb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
},
"dependencies": {
"cheerio": "1.0.0-rc.12",
"fortigate-web-sslvpn": "^1.0.0"
"fortigate-web-sslvpn": "^1.1.0"
}
}
7 changes: 5 additions & 2 deletions packages/library/src/fetcher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const readSignaturesPageFromWebVPN = async (username: string, password: s
const response = await vpn.request(SIGNATURES_URL, {
method: "POST",
headers: { ...SIGNATURES_HEADERS },
body: createLoginBody(username, password)
body: createLoginBody(username, password),
encoding: "latin1"
});

if (response.status !== 200) {
Expand All @@ -26,5 +27,7 @@ export const readSignaturesPage = async (username: string, password: string) =>
body: createLoginBody(username, password)
});

return response.text();
const buffer = await response.arrayBuffer();
const decoder = new TextDecoder("latin1");
return decoder.decode(buffer);
};
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 15557eb

Please sign in to comment.