简体   繁体   中英

AWS SDK .NET custom metadata with non-ASCII characters

I am trying to upload object to S3 with custom metadata. If I use ASCII only it works fine (I use HttpUtility.HtmlEncode to escape some special symbols).

However if I want to send a text with French symbols in it I got S3 exception (same as if I used unescaped special symbols)

You cannot use non-ASCII characters for S3 user-defined metadata when using either REST API or the AWS SDK (since AWS SDK is basically wrapper libraries that wrap the underlying Amazon S3 REST API):

User-defined metadata is a set of key-value pairs. Amazon S3 stores user-defined metadata keys in lowercase. Each key-value pair must conform to US-ASCII when you are using REST and to UTF-8 when you are using SOAP or browser-based uploads via POST.

While UTF-8 is supported for both; SOAP and browser-based uploads using POST, AWS recommends that you use either the REST API or the AWS SDKs saying that new features will not be supported for SOAP:

SOAP support over HTTP is deprecated, but it is still available over HTTPS. New Amazon S3 features will not be supported for SOAP. We recommend that you use either the REST API or the AWS SDKs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM