0
使用AWS-SDK爲Javascript我遇到一個奇怪的問題,即特殊的字符不被把文本轉換爲對象AWS S3 putObject符號特殊chracters
這裏經過翻譯是我的代碼:
var AWS = require('aws-sdk');
AWS.config.update({
region: "us-east-1",
endpoint: "s3.amazonaws.com"
});
var s3 = new AWS.S3();
var params = {
Bucket: 'test-example',
Key: 'test.html',
Body: 'Copyright © 2017',
ACL:'public-read',
ContentType: 'text/html'
}
s3.putObject(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
這使得該顯示一個HTML頁面: 「版權©2017年」
如何刪除加字符Â
您是否嘗試將'ContentEncoding:'utf8''添加到'params'對象? – madebydavid
utf8不是有效的內容編碼,@madebydavid。 'text/html的; charset = utf-8'然而,對於ContentType似乎是一個合適的值 –
@ Michael-sqlbot完美的工作!非常感謝!!想把它作爲這個問題的答案嗎? – TonyDiaz