Azure Function Powershell: How to change encoding for push-outputbinding

Schott Ludwig 1 Reputation point

When retrieving data from an online API, converting it to JSON and using Push-Outputbinding to write to Azure Data Lake Gen2 Container, special characters are off:
Code snippet:

#Convert PSCustomObject ($APIResults) to JSON and write to Azure Data Lake Gen2
$APIResultsJSON = $APIResults | ConvertTo-Json -depth 20
Push-OutputBinding -Name dataoutputBlob -Value $APIResultsJSON

Examples for changed characters:
Ü --> is transformed to Ãœ
在庫金額 --> is transformed to 在庫金é¡

Running the Powershell Script locally, using:

$APIResults | ConvertTo-Json -depth 20 | Out-File ($BasePath+$DataPath)

works fine (with correct encoding).

How can I change the encoding behavior in Azure Function (Powershell)?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,486 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 69,846 Reputation points

    Hi @Schott Ludwig

    Welcome to Microsoft Q&A! Thanks for posting the question.

    I don't see any issue with the Push-OutputBinding at my end. Whatever data I have received it is saving the same data in my Azure Data Lake Gen2 Container.


    Downloading the blob file I can see the same data that I have written

    Hello 在庫金額, This HTTP triggered function executed successfully.

    I will suggest you to log the value of $APIResultsJSON on your function app to double check whether the data is converted before writing it to the Output binding.
    There could be issue that the data would have converted when you have retrieve data from your API call. This will help you to figure out where exacting the data is converted.