title: getline() doesn't read accented characters correctly
body: <p>I'm trying to get accented characters from user using <code>getline()</code> command, but it does not print them correctly.</p>
  
  <p>I tried to include some libraries as <code>locale</code>, but it was in vain.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;string&gt;
  #include &lt;locale&gt;
  
  using namespace std;
  
  class Pers {
  public:
      string name;
      int age;
      string weapon;
  };
  
  int main()
  {
      setlocale(LC_ALL, "");
      Pers pers;
  
      cout &lt;&lt; "Say the name of your character: ";
      getline(cin, pers.name);
      cout &lt;&lt; pers.name;
  }
  </code></pre>
  
  <p>When I type: Mark Coração, this is what I get:</p>
  
  <p><a href="https://i.stack.imgur.com/Vnz6S.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vnz6S.jpg" alt="Accented characters aren&#39;t displaying correctly"></a></p>
  
  <p>How do I fix it?</p>