我們使用這個代碼來生成請求,並設置文件名進行下載:如何在S3的response-content-disposition頭中使用unicode字符?
var request = new GetPreSignedUrlRequest()
.WithBucketName(S3BucketName)
.WithExpires(requestExpirationTime)
.WithKey(file.S3Key)
.WithResponseHeaderOverrides(
new ResponseHeaderOverrides()
.WithContentDisposition("attachment; filename=\"Unicode FileName ᗩ Test.txt\""));
這會產生以下鏈接:
/s3path?AWSAccessKeyId=xxxx&Expires=1377199946&response-content-disposition=attachment%3B%20filename%3D"Unicode%20FileName%20ᗩ%20Test.txt"&Signature=xxxxx
其中給出這個錯誤:
<Error>
<Code>InvalidArgument</Code>
<Message>
Header value cannot be represented using ISO-8859-1.
</Message>
<ArgumentValue>attachment; filename="Unicode ᗩ filename.txt"</ArgumentValue>
<ArgumentName>response-content-disposition</ArgumentName>
<RequestId>368BD60502854514</RequestId>
<HostId>
BiUUYp4d9iXfK68jKVxWZEp25m5je166M0ZY1VmoPk9pN9A69HLHcff6WIVLWk1B
</HostId>
</Error>
我們如何在response-content-disposition頭中使用非ISO-8859-1字符,如unicode?
AWS論壇主題:https://forums.aws.amazon.com/thread.jspa?threadID=133257 –