we are writing a solution to upload email attachments to blob Storage using Azure Function app.
Below is code for uploading the csv file to Storage.
const attachment_filebuff = Buffer.from(attachmentContentString,'base64');
const decoded_content = new Buffer(attachment_filebuff);
//Blob connection details
const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;
if (!accountName) throw Error('Azure Storage accountName not found');
const blobServiceClient = new BlobServiceClient(`https://${accountName}.blob.core.windows.net`,new DefaultAzureCredential());
// create container client
const containerClient = await blobServiceClient.getContainerClient(containerName);
// Push data to decoded storage
const blkBlobClt = containerClient.getBlockBlobClient(mainBlobpath);
const blobOptions = { blobHTTPHeaders: { blobContentType: 'text/plain', blobContentEncoding: 'UTF-8' } };
await blkBlobClt.uploadData(decoded_content,blobOptions);
but when we download the uploaded file, and open it in notepad++
its encoding is coming as UCS-2 LE BOM instead of UTF-8
could anyone advise what am i missing here ?