0
votes

Question about using Azure Service Bus to send message with unicode (Chinese characters). After sending a message with unicode chars with this code:

        string msgBody = JsonConvert.SerializeObject(msg);
        var message = new Message(Encoding.Unicode.GetBytes(msgBody));
        await QueueClient.SendAsync(message);
        await QueueClient.CloseAsync();

where msg contains Chinese characters. An Azure Function triggered by the message crashed with an exception:

System.Private.CoreLib: Exception while executing function: Function1. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'myQueueItem'. Microsoft.Azure.WebJobs.ServiceBus: The Message with ContentType 'null' failed to deserialize to a string with the message: 'There was an error deserializing the object of type System.String. The input source is not correctly formatted.'. System.Private.DataContractSerialization: There was an error deserializing the object of type System.String. The input source is not correctly formatted. System.Private.DataContractSerialization: The input source is not correctly formatted.

Any idea to trigger an Azure function using unicoded message?

1

1 Answers

0
votes

fixed! UTF8 seems working well.