title: Write Unicode UTF-8 and UTF-16 data into a QByteArray
body: <p>I'm developing a protocol for my company using Qt. It is required to query the Window Registry and write the value obtained into a prenegotiated socket. I have read the Registry Data into a <code>QString</code>. I must use 8-bit Unicode characters and for some 16-bit Unicode characters. I am using <code>QByteArray</code> to store all the data before writing to the socket using <code>QTcpSocket::write()</code>. Little Endianness must be followed.</p>
  
  <ol>
  <li><p>How do I get the data from <code>QString</code> into <code>QByteArray</code> in Unicode 8 bit format (specification says character type corresponds to <code>quint8</code>)?</p></li>
  <li><p>How do I get the data from <code>QString</code> into <code>QByteArray</code> in Unicode 16 bit format (specification says character type corresponds to <code>quint16</code>)?</p></li>
  <li><p>How can I maintain Little Endianness in all cases?</p></li>
  </ol>
  
  <p>(I have no experience of dealing with Unicode/variable-byte-encoded data)</p>