我做的對Web服務的下列請求(使用請求/請求):Node.js的要求變成變音符號來
return request.postAsync({
url,
charset: 'Cp1252', // I also tried utf-8
encoding: null, //
// I also tried Cp1252 -> unknown encoding,
// I also tried utf-8 and nothing at all
headers: {
"Accept": "application/octet-stream, text, text/plain, text/xml",
"Accept-Encoding": "UTF-8",
'Content-Type': "text/plain; charset=Cp1252;", // also tried utf-8, ISO-8859-1
"User-Agent": "me"
}
}).spread((res, body) => {
body = body.toString(); // I also tried without toString();
let ws = fs.createWriteStream('hhh.csv');
ws.write(body);
ws.end();
無論我做什麼,變音符號都變成�
。
這些都是頭Web服務發送回:
'content-type': 'text; charset=Cp1252',
'content-length': '1895980',
vary: 'Accept-Encoding,User-Agent'
我沒有運氣可言嘗試這幾天。我究竟做錯了什麼?
這裏的問題/答案的列表,並沒有解決我的問題至今:
- Umlauts broken when doing get request
- Problems making http-post requests with German umlauts (ä ö ü) or special chars (ß) with Node.js
- Send umlauts from Node.js to iOS
- Automatic UTF-8 encoding in Node.js HTTP client
- Custom HTTP header value - trying to pass umlaut characters
- How to get UTF-8 in Node.js?
- How to get i18next-node to display umlauts the right way?
- How do I URl encode something in Node.js?
它可以是下列之一引起我的輸入字符串不爲UTF-8?
let hash = crypto.createHmac("sha256", this.options.Signer);
this.query['Signature'] = hash.update(stringToSign).digest("base64");
簽名者是含有0-9
,a-z
,A-Z
,+
,和/
的字符串。
this.query['Signature']
是URL的一部分。
什麼是您要發送的確切字符?他們目前的編碼方式如何,當前的字符集是什麼? – zerkms
在元音變「仍」變音符的地方。 – zerkms
「節點js請求將元音變成 」「無論我做什麼,變音都變成 。」 ---這些短語意味着什麼? – zerkms