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

标签 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 字符设置为元数据值?

最佳答案

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

关于azure - 在 Azure 存储元数据中使用国际字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48672712/

相关文章:

azure - Service Fabric -(达到 MaxReplicationMessageSize)可靠字典中的大量数据

Azure 队列创建最佳实践和规模

azure - Azure 客户端 .OnMessage 是否为空队列生成计费请求?

c# - Azure消息总线异步检索数据并通过 Controller 操作返回数据

Azure 函数中的 Python config.py 文件

rest - 如何避免 Golang 服务器 (Gin Gonic) 在 INTERNAL_ERROR 上崩溃

go - 关于接口(interface) "All Known Implementation"的文档

go - 如何为golang项目的RPM规范创建构建部分?

azure - 在 Azure 中以编程方式创建 Blob 存储服务

c# - 尝试使用 PowerShell 列出 Azure 文件服务中的共享时身份验证失败