diff --git a/Services/SolaceSubscribeService.cs b/Services/SolaceSubscribeService.cs index 6259d93..cec8f9e 100644 --- a/Services/SolaceSubscribeService.cs +++ b/Services/SolaceSubscribeService.cs @@ -67,8 +67,17 @@ public void HandleMessage(object source, MessageEventArgs args, Action m { using (IMessage message = args.Message) { - string messageContent = Encoding.ASCII.GetString(message.BinaryAttachment); - messageHandler(messageContent); + string messageContent; + + byte[] binaryAttachment = message.BinaryAttachment; + if (binaryAttachment != null && binaryAttachment.Length > 0) + { + messageContent = Encoding.UTF8.GetString(binaryAttachment); + messageHandler(messageContent); + } else + { + messageHandler("Message without payload"); + } } } catch (OperationErrorException ex)