Using Powershell 7.2 and Azure Durable Function.
I am looking for some assistance regarding an issue I have been facing and for the love of all that is good, I can’t seem to resolve it.
I have an Azure Durable Function with a HTTP trigger and orchestration.
I am sending JSON Body to the HTTP trigger, which include a British Pound Symbol (£).
When I output $Request.Body – I can see the pound symbol decoded correctly in the HTTP Trigger output, either output to console or push output binding.
However, the issue appears as soon as I pass the $Request.Body , to the durable function as an INPUT
and then read the $Context in the orchestrator, I receive � instead of £.
Have tried several suggestions to force UTF-8
Firstly in the HTTP Trigger, before the data is passed to the orchestration
Secondly, using Context when the data is received by the orchestration.
Something on the lines of :
$requestBodyBytes = [System.Text.Encoding]::UTF8.GetBytes($Request.Body.ToString()) $requestContent = [System.Text.Encoding]::UTF8.GetString($requestBodyBytes)
I have tried sending the data as JSON but also as text, with just the British Pound symbol.
When using the above mentioned method, the symbol becomes a ? instead of the diamond symbol � . That is the only difference I spotted.
The issue just appears that when azure function passes the data from the HTTP Trigger, to the orchestration, that is when the encoding issue seems to occur.
$obj = [PSCustomObject]@{ symbol = ($Request.Body).symbol } $obj.symbol
Return : [2024-06-10T12:12:36.414Z] OUTPUT: £
When letting it get to the orchestator, and then output what is shown using the StatusQueryURI
"input": { "symbol": "�" }, "customStatus": null, "output": { "Input": { "symbol": "�" },
Unfortunately, I can’t specify ASCII characters and then decode, as the symbol is part of another API request which requires that the pound symbol is shown as the symbol itself.
TKMane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.