Auto URL encode couldn't be used at cloud to device

minew 0 Reputation points
2024-01-19T10:29:45.9566667+00:00

Data was sent via Azure IoT Hub's Cloud to Device channel, and the gateway is using the lts_01_2023 branch of the Azure IoT SDK C. It printed 'Unprintable value in encoded string'. See below for detailed information. However, the data I actually sent was just a simple JSON format and didn't include any properties values.

{
    "messageId": "TUC2T1_975",
    "correlationId": "0",
    "deviceSerialNumber": "1112223456",
    "timestamp": 1578039797522,
    "messageType": "TAGUPDATEREQ",
    "message": {
    },
    "facilityId": "349"
}

Func:calculateDecodedStringSize Line:145 Unprintable value in encoded string
Error: Time:Fri Jan 19 08:37:03 2024 File:azure-iot-sdk-c/c-utility/src/urlencode.c Func:URL_Decode Line:330 URL_Decode:: Invalid input string
Error: Time:Fri Jan 19 08:37:03 2024 File:azure-iot-sdk-c/iothub_client/src/iothubtransport_mqtt_common.c Func:addSystemPropertyToMessageWithDecodeIfNeeded Line:1692 Failed to URL decode property value
Error: Time:Fri Jan 19 08:37:03 2024 File:azure-iot-sdk-c/iothub_client/src/iothubtransport_mqtt_common.c Func:processIncomingMessageNotification Line:1969 failure extracting mqtt properties.
Error: Time:Fri Jan 19 08:38:04 2024 File:azure-iot-sdk-c/c-utility/src/urlencode.c Func:calculateDecodedStringSize Line:145 Unprintable value in encoded string
Error: Time:Fri Jan 19 08:38:04 2024 File:azure-iot-sdk-c/c-utility/src/urlencode.c Func:URL_Decode Line:330 URL_Decode:: Invalid input string
Error: Time:Fri Jan 19 08:38:04 2024 File:azure-iot-sdk-c/iothub_client/src/iothubtransport_mqtt_common.c Func:addSystemPropertyToMessageWithDecodeIfNeeded Line:1692 Failed to URL decode property value
Error: Time:Fri Jan 19 08:38:04 2024 File:azure-iot-sdk-c/iothub_client/src/iothubtransport_mqtt_common.c Func:processIncomingMessageNotification Line:1969 failure extracting mqtt properties.
    bool url_encode_on = true;
    (void)IoTHubDeviceClient_SetOption(
        actx->device_handle, OPTION_AUTO_URL_ENCODE_DECODE, &url_encode_on);

I later found out that there were no issues once I turned off the automatic URL encoding. However, everything was working fine until yesterday, and from today, the Cloud to Device feature couldn't be used. It only worked after disabling the Auto URL encode. I would like to know if there has been a malfunction with Azure IoT Hub.

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,200 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
222 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.