title: Why doesn't printf format unicode parameters?
body: <p>When using printf to format a double-byte string into a single-byte string:</p>
  
  <pre><code>printf("%ls\n", L"s:\\яшертыHello");   // %ls for a wide string (%s varies meaning depending on the project's unicode settings).
  </code></pre>
  
  <p>Clearly, some characters can't be represented as ascii characters, so sometimes I have seen behaviour where double-byte characters get turned into a '?' mark character. But, this seems to depend on the particular characters. For the printf above, the output is:</p>
  
  <pre><code>s:\
  </code></pre>
  
  <p>I was hoping I might get something like:</p>
  
  <pre><code>s:\??????Hello
  </code></pre>
  
  <p>I'm afraid I've lost the example, but I think for one string when it encountered unicode characters, replaced the first one with a '?' and then gave up on the rest.</p>
  
  <p>So, my question is, what's supposed to happen when you format a wide string into a single-byte string. Documentation here: <a href="http://msdn.microsoft.com/en-us/library/hf4y5e3w.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/hf4y5e3w.aspx</a> says "Characters are displayed up to the first null character". But, I'm not seeing that. Is this a bug in printf, or is  the behaviour I'm seeing documented somewhere, if so, where.</p>
  
  <p>Thanks for your help.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks for the answers from people giving me alternatives to using printf. I am going to change to an alternative, but I'm really interested out of curiosity why does printf not have reliable documented behaviour. It appears almost as if the implementer of it went out of their way to make this not work.</p>