Hi All,
Can somebody help me here quickly?
I am receiving one json from device which contain some special character so while sending to iot hub, I have set the ContentEncoding = "utf-8" below is the code .
Message iotHubMessage = new Message(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(messageObject)))
{
ContentEncoding = "utf-8",
ContentType = "application/json"
};
Json I am receiving from device
{
"nameKey": "StO2",
"name": "StO₂ A2",
"englishName": "StO₂ A2",
"parameterType": "StO2A2",
"isUnassignedValue": false,
"measurementUnitsValue": 62.785713195800781,
"measurementUnitsValueWithPrecision": 63.0,
"formattedValue": "63",
"formattedEnglishLowerAlarmMessage": "Alarm: StO₂ A2 is below low limit",
"formattedEnglishUpperAlarmMessage": "Alarm: StO₂ A2 exceeded high limit",
}
So when I am checking the data IoT hub side some addition character is getting added looks like it in unable to encode O2.
Json from IoT hub:
{
"nameKey": "StO2",
"name": "StO??? A1",
"englishName": "StO??? A1",
"parameterType": "StO2A1",
"isUnassignedValue": false,
"measurementUnitsValue": 61.28571319580078,
"measurementUnitsValueWithPrecision": 61.0,
"formattedValue": "61",
"formattedEnglishLowerAlarmMessage": "Alarm: StO??? A1 is below low limit",
"formattedEnglishUpperAlarmMessage": "Alarm: StO??? A1 exceeded high limit",
}
see the "englishName" in both the json.
Can somebody help me here how can i get the same json?.
What can I do in code level ?.
Please help me here.