Hi Zelin Wang (US),
The "TranslateException" you are seeing due to the issue with the Azure Storage SDK or due to the connection to Azure Blob Storage.
Here are few steps to follow.
- Check whether the blob blobPath is URL-encoded properly. Non-ASCII characters need to be properly encoded to ensure they are transmitted over HTTP without any errors.
- The path you are using in the downloadToFile method should not contain double slashes (//). This will raise the issues when the file is being created. Use only single slash (/).
- Check the BlobPath variable is correctly is pointing to the blob you want to download. Verify it through a console output can help that it is encoded properly and matches the actual blob path within the container.
- Check that the container and the blob exists in Azure Blob Storage. You can use the Azure Portal or Azure Storage Explorer to check if the blob exists and check you have the correct permissions to access it.
- Check the connection details that your connection string, account name, key are valid. You can create a CloudStorageAccount and a CloudBlobClient to check if you're able to connect properly. If there is any issue with the connection, it will cause exceptions during blob access.
By ensuring that the blob path is properly URL-encoded and correcting the file path format, you should be able to resolve the "TranslateException" and successfully download the file with Asian characters in its name.
- Upload: No need to encode the file name, as Azure handles non-ASCII characters without issues.
- Download/Access: Ensure the blob path is URL-encoded (especially for non-ASCII characters) to avoid errors during access.
Please let us know if you have any further queries. I’m happy to assist you further.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.