title: How to get input with special characters in c++
body: <p>I figured console output with special characters(é ü ğ ö ş) with locale::global() function. But couldn't find any way to get input with those special characters.</p>
  
  <pre><code>string str;
  getline(cin, str);
  cout &lt;&lt; str;
  </code></pre>
  
  <p>When I type "Léon ç.ş.ö.ü"</p>
  
  <blockquote>
    <p>L'on ┼.Y.".?</p>
  </blockquote>
  
  <p>This is the output. How can i fix this?</p>
  
  <p>EDIT: Problem is fixed. My setlocale command was right under the main function. All I did is setting locale somewhere else. When I do this. It just worked fine. I don't know why.</p>
  
  <pre><code>string str;
  getline(cin, str);
  cout &lt;&lt; str;    
  setlocale(LC_ALL, "Turkish");
  </code></pre>
  
  <p>EDIT 2: This works much better. Works with file i/o too.</p>
  
  <pre><code>#include &lt;Windows.h&gt;
  SetConsoleOutputCP(1254);
  SetConsoleCP(1254);
  </code></pre>