title: C++ Literals and Unicode
body: <p>C++ Literals</p>
  
  <p>Environment:</p>
  
  <ul>
  <li>OS: Windows 10 Pro;</li>
  <li>Compiler: GCC latest.</li>
  <li>IDE: Code::Blocks latest.</li>
  <li>working on: Console applications.</li>
  </ul>
  
  <p>My understanding for numerical literals prefixes is that  they are useful to determine the numerical value type (not sure).However, I have a lot of confusion on character and string literals prefixes and suffixes. I read a lot and spent days trying to understand the situation, but I got more questions and few answers. so I thought stack overflow could be of a lot of help.</p>
  
  <p>Qs:</p>
  
  <p>1- What are the correct use for the string prefixes u8 u U L?</p>
  
  <p>I have the following code as example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {
      cout &lt;&lt; "\n\n Hello World! (plain) \n";
      cout &lt;&lt; u8"\n Hello World! (u8) \n";
      cout &lt;&lt; u"\n Hello World! (u) \n";
      cout &lt;&lt; U"\n Hello World! (U) \n";
      cout &lt;&lt; L"\n Hello World! (plain) \n\n";
  
      cout &lt;&lt; "\n\n\n";
  }
  </code></pre>
  
  <p>The output is like this:</p>
  
  <blockquote>
    <p>Hello World! (plain)</p>
    
    <p>Hello World! (u8)</p>
    
    <p>0x47f0580x47f0840x47f0d8</p>
  </blockquote>
  
  <p>Q2: Why U u ans L has such output? I expected it is just to determine type not do encoding mapping (if it is).</p>
  
  <p>Q3 Is there a simple and to the point references about encodings like UTF-8. I am confused about them, in addition I doubt that console applications is capable to deal with them. I see it is crucial to understand them.</p>
  
  <p>Q4: Also I will appreciate a step by step reference that explain custom type literals.</p>