title: Putting Message in Websphere MQ via C# has different data length than manually putting the same message
body: <pre><code>MQMessage queueMessage = new MQMessage();
                  queueMessage.WriteString(strInputMsg);
                  queueMessage.Format = MQC.MQFMT_STRING;
                  MQPutMessageOptions queuePutMessageOptions = new MQPutMessageOptions();
                  Queue.Put(queueMessage, queuePutMessageOptions);
  </code></pre>
  
  <p>Using C#, with the above code, when I input the message into the queue, the data length of the message is 3600.</p>
  
  <p>When I manually input the message into the queue by right clicking the queue and selecting Put Test Message option, the data length of the message is 1799.</p>
  
  <p>I am really confused why this is the case.  The message in both cases is an xml string with  declaration.  In Notepad++, there are 1811 characters including the declaration.  When I view the message in debugger before I input into the queue, the message is converted into xml without any line or return carriages.</p>
  
  <p>I created the xml string using:</p>
  
  <pre><code>//converts string message into xml by serializing it
   public string GetMessage(MyMessage messageInstance)
  {
  
  // Serialize the request
              XmlSerializer xsr = new XmlSerializer(typeof(MyMessage));
              MemoryStream memoryStream = new MemoryStream();
              XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
              xsr.Serialize(xmlTextWriter, messageInstance);
  
              memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
              string XmlizedString = new UTF8Encoding().GetString((memoryStream.ToArray());
  
  
              // Encode the xml
              Encoding utf = Encoding.UTF8;
              byte[] utfBytes = utf.GetBytes(XmlizedString);
  
              // Load the document (XmlResolver is set to null to ingore DTD)
              XmlDocument xmlDoc = new XmlDocument();
              xmlDoc.XmlResolver = null;
              xmlDoc.LoadXml(utf.GetString(utfBytes));
              return utf.GetString(utfBytes);
  </code></pre>
  
  <p>Am I missing anything in my C# implementation that is adding extra characters?</p>
  
  <p>Thanks.</p>