title: Can you specify encoding type when uploading a file to Azure storage blob using Set-AzureStorageBlobContent or ConvertTo-Json cmdlet?
body: <p>I have a PowerShell script that downloads a JSON file stored in an Azure storage account blob. This file is in UTF-8 encoding. The script then reads from the JSON, makes the changes, creates a new JSON file with the same name, and uploads that back to the storage account using Set-AzureStorageBlobContent cmdlet. However, all the applications that were using that JSON file stopped working. After hours of troubleshooting, I noticed that when it uploads the new JSON back to the storage container (replacing the existing one), it uploads the JSON in a UTF-16 encoding. </p>
  
  <p>Is there a parameter in Set-AzureStorageBlobContent cmdlet where I can specify the encoding? I looked into the official documentation but couldn't find an answer. </p>
  
  <p>Before I upload the new JSON in, all the values are stored in a variable and I actually use the cmdlet ConvertTo-Json to generate the new JSON file. Is there a parameter in ConvertTo-Json to specify the encoding type? </p>
  
  <p>Right now, all I use to upload the file is:</p>
  
  <pre><code>$jsonContent | ConvertTo-Json -Depth 4 | Out-File C:\P3\myFile.json
  
  Set-AzureStorageBlobContent -Context $storageContext -Container "myContainer" -File "myFile.JSON"  -Force
  </code></pre>
  
  <p>Please advise!</p>