Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, sorry I probably don't have the fonts required so I cannot test it yet. </p> <p>Something looks a bit fishy here</p> <pre><code>// the following is said to be working SetConsoleOutputCP(CP_UTF8); // output is in UTF8 wchar_t s[] = L"èéøÞǽлљΣæča"; int bufferSize = WideCharToMultiByte(CP_UTF8, 0, s, -1, NULL, 0, NULL, NULL); char* m = new char[bufferSize]; WideCharToMultiByte(CP_UTF8, 0, s, -1, m, bufferSize, NULL, NULL); wprintf(L"%S", m); // &lt;-- upper case %S in wprintf() is used for MultiByte/utf-8 // lower case %s in wprintf() is used for WideChar printf("%s", m); // &lt;-- does this work as well? try it to verify my assumption </code></pre> <p>while</p> <pre><code>// the following is said to have problem SetConsoleOutputCP(CP_UTF8); utf8_locale = locale(old_locale, new boost::program_options::detail::utf8_codecvt_facet()); wcout.imbue(utf8_locale); wcout &lt;&lt; L"¡Hola!" &lt;&lt; endl; // &lt;-- you are passing wide char. // have you tried passing the multibyte equivalent by converting to utf8 first? int bufferSize = WideCharToMultiByte(CP_UTF8, 0, s, -1, NULL, 0, NULL, NULL); char* m = new char[bufferSize]; WideCharToMultiByte(CP_UTF8, 0, s, -1, m, bufferSize, NULL, NULL); cout &lt;&lt; m &lt;&lt; endl; </code></pre> <p>what about</p> <pre><code>// without setting locale to UTF8, you pass WideChars wcout &lt;&lt; L"¡Hola!" &lt;&lt; endl; // set locale to UTF8 and use cout SetConsoleOutputCP(CP_UTF8); cout &lt;&lt; utf8_encoded_by_converting_using_WideCharToMultiByte &lt;&lt; endl; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload