0
votes

I have Chinese/Mandarin characters in a file that I'm uploading to Azure blob, e.g. 此测试.jpg

When I drag and drop this file to Azure via Azure Explorer (as a test to make sure the environment can handle it) - then the file uploads perfectly with the filename : 此测试.jpg (when I use a different Azure Explorer from Redgate then it gets uploaded as ????.jpg)

I follow the normal boilerplate code to upload

 Dim storageAccount As CloudStorageAccount = CloudStorageAccount.Parse(
            CloudConfigurationManager.GetSetting("StorageConnectionString"))
 Dim blobClient As CloudBlobClient = storageAccount.CreateCloudBlobClient()
 Dim blockBlob As CloudBlockBlob = container.GetBlockBlobReference(filename)
  blockBlob.UploadFromByteArray(FileBytes, 0, FileBytes.Length)

, but it gets uploaded as ????.jpg

How can I upload the file to blob to have the correct (special character) filename? I saw php examples but nothing related to .net which I could apply

1

1 Answers

0
votes

I don't think this is a problem related to your upload code. There are different types of Chinese character encoding and unfortunately only unicode would play nicely with .Net

I would grab the file name (Likely it's encoded in GB since it's simplified chinese), convert it to unicode follow the suggestions here

Unicode chinese is expected to work, but they are still considered to be special character. If it still gives you problem, you will probly need to wrap in Base64 encoding or URLencoding in addition to unicode. These two encoding method would not work with GB or Big5.