在azure存储元数据中使用国际字符?

时间:2018-02-07 20:29:37

标签: azure go azure-storage

当我使用this azure library

运行此请求时

blobURL.PutBlob(ctx, strings.NewReader("Some text"), azblob.BlobHTTPHeaders{}, azblob.Metadata{"Foo": "/愛知県/bar"}, azblob.BlobAccessConditions{})

我收到此错误:

===== RESPONSE ERROR (ServiceCode=AuthenticationFailed) =====
Description=Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:daf8a672-001e-000e-2f4b-a033f3000000
Time:2018-02-07T19:38:09.6740273Z, Details: 
   AuthenticationErrorDetail: The MAC signature found in the HTTP request 'REDACTED' is not the same as any computed signature. Server used following string to sign: 'PUT

9

x-ms-blob-cache-control:
x-ms-blob-content-disposition:
x-ms-blob-content-encoding:
x-ms-blob-content-language:
x-ms-blob-content-type:
x-ms-blob-type:BlockBlob
x-ms-client-request-id:f18fd538-3780-4f62-5236-777ac244affa
x-ms-date:Wed, 07 Feb 2018 19:38:09 GMT
x-ms-meta-foo:/愛知県/bar
x-ms-version:2016-05-31
/MYACCOUNT/MYCONTAINER/ReadMe.txt
timeout:61.
   PUT https://MYACCOUNT.blob.core.cloudapi.de/MYCONTAINER/ReadMe.txt?timeout=61
   Authorization: REDACTED
   Content-Length: [9]
   User-Agent: [Azure-Storage/0.1 (go1.9.3; darwin)]
   X-Ms-Blob-Cache-Control: []
   X-Ms-Blob-Content-Disposition: []
   X-Ms-Blob-Content-Encoding: []
   X-Ms-Blob-Content-Language: []
   X-Ms-Blob-Content-Type: []
   X-Ms-Blob-Type: [BlockBlob]
   X-Ms-Client-Request-Id: [f18fd538-3780-4f62-5236-777ac244affa]
   X-Ms-Date: [Wed, 07 Feb 2018 19:38:09 GMT]
   X-Ms-Meta-Foo: [/愛知県/bar]
   X-Ms-Version: [2016-05-31]
   --------------------------------------------------------------------------------
   RESPONSE Status: 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
   Content-Length: [936]
   Content-Type: [application/xml]
   Date: [Wed, 07 Feb 2018 19:38:09 GMT]
   Server: [Microsoft-HTTPAPI/2.0]
   X-Ms-Request-Id: [daf8a672-001e-000e-2f4b-a033f3000000]


exit status 1

这是因为“/爱知県/ bar”!=“/æ”>知県/ bar“? 您是否认为可以将“/爱知県/ bar”等非ascii字符设置为元数据值?

1 个答案:

答案 0 :(得分:1)

既然你在标签中提到了Go,我认为你正在寻找使用音译器,github中有这个你应该尝试 :https://github.com/rainycape/unidecode