title: Convert UTF8 to UTF16 using iconv
body: <p>When I use iconv to convert from UTF16 to UTF8 then all is fine but vice versa it does not work.
  I have these files:</p>
  
  <pre><code>a-16.strings:    Little-endian UTF-16 Unicode c program text
  a-8.strings:     UTF-8 Unicode c program text, with very long lines
  </code></pre>
  
  <p>The text look OK in editor. When I run this:</p>
  
  <pre><code>iconv -f UTF-8 -t UTF-16LE a-8.strings &gt; b-16.strings
  </code></pre>
  
  <p>Then I get this result:</p>
  
  <pre><code>b-16.strings:    data
  a-16.strings:    Little-endian UTF-16 Unicode c program text
  a-8.strings:     UTF-8 Unicode c program text, with very long lines
  </code></pre>
  
  <p>The <code>file</code> utility does not show expected file format and the text does not look good in editor either. Could it be that iconv does not create proper BOM? I run it on MAC command line.</p>
  
  <p>Why is not the b-16 in proper UTF-16LE format? Is there another way of converting utf8 to utf16?</p>
  
  <p>More elaboration is bellow.</p>
  
  <pre><code>$ iconv -f UTF-8 -t UTF-16LE a-8.strings &gt; b-16le-BAD-fromUTF8.strings
  $ iconv -f UTF-8 -t UTF-16 a-8.strings &gt; b-16be.strings 
  $ iconv -f UTF-16 -t UTF-16LE b-16be.strings &gt; b-16le-BAD-fromUTF16BE.strings
  
  $ file *s
  a-16.strings:                   Little-endian UTF-16 Unicode c program text, with very long lines
  a-8.strings:                    UTF-8 Unicode c program text, with very long lines
  b-16be.strings:                 Big-endian UTF-16 Unicode c program text, with very long lines
  b-16le-BAD-fromUTF16BE.strings: data
  b-16le-BAD-fromUTF8.strings:    data
  
  
  $ od -c a-16.strings | head
  0000000  377 376   /  \0   *  \0      \0  \f 001   E  \0   S  \0   K  \0
  
  $ od -c a-8.strings | head 
  0000000    /   *   *   *       Č  **   E   S   K   Y       (   J   V   O
  
  $ od -c b-16be.strings | head
  0000000  376 377  \0   /  \0   *  \0   *  \0   *  \0     001  \f  \0   E
  
  $ od -c b-16le-BAD-fromUTF16BE.strings | head                                
  0000000    /  \0   *  \0   *  \0   *  \0      \0  \f 001   E  \0   S  \0
  
  $ od -c b-16le-BAD-fromUTF8.strings | head
  0000000    /  \0   *  \0   *  \0   *  \0      \0  \f 001   E  \0   S  \0
  </code></pre>
  
  <p>It is clear the BOM is missing whenever I run conversion to UTF-16LE. 
  Any help on this?</p>