Jeff_hu
Jeff_hu

Reputation: 427

Is it possible to change files’ encoding azure blob storage using C#

I use polybase to export file to storageAccount. But the encoding is UTF8. I need to change it to SJIS. is there any easy way to change it to SJIS using C#? is it possible to do it by using blobstorage’s rest api

Upvotes: 0

Views: 2913

Answers (1)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 29950

For api, you can use Set Blob Properties, then set x-ms-blob-content-encoding in the request header.

For code, if you're using azure blob storage sdk, you can refer to this article. You should modify the code, since the sample for getting properties of container. You can use sample code for setting blob property as below:

  CloudBlobContainer blobContainer = blobClient.GetContainerReference("xxx");
  CloudBlockBlob myblob = blobContainer.GetBlockBlobReference("xxx");

  myblob.Properties.ContentEncoding = "SJIS";
  myblob.SetProperties();

Upvotes: 1

Related Questions