I have an azure function that is .net core 3 (latest supported) that receives JSON's from Microsoft Dynamics 365 (Common Data Service) when a contact is created or updated. I am doing no transformation to the data, just grabbing the JSON and placing it in a Service Bus queue. The issue is with international characters. Example. the data in Dynamics for first name is
José
But, as soon as it hits the Azure Function it becomes
José
I removed any UTF-8 encoding that I was doing when reading the body of the HTTP request that this is in and that didn't fix the issue. I have tried a couple of things and can't figure out what is happening to the data even before I try to read it.
Here is what I have tried. I need to read the data as it is in Dynamics and convert it to UTF-8 as the system I am sending the data too is using UTF-8.
Original:
string requestBody = await CommonFactory.StreamReader(req.Body).ReadToEndAsync();
I have tried the following:
string requestBody = await req.Content.ReadAsStringAsync();
dynamic data = await req.Content.ReadAsAsync<object>();
I have also tried to see the headers that are sent and content-type does not include the charset value. Just has
application/json
I am hoping that someone else has run across issues with string encoding with .NET core and can help point me in the right direction. Right now, I am trying to switch to memory stream to see if that helps at all.