Any Encoding, Ever – ztd.text and Unicode for C++
Why are the examples for ztd.text writing UTF-16 to std::cout? Won&#x27;t this fail on Linux where UTF-16 is rarely used and terminals typically default to UTF-8?<p>Personally I&#x27;ve enjoyed using the tiny-weeny header only utfcpp[0] for simple manipulation of UTF-8 and unicode-to-unicode conversions, and typically use Boost.Locale[1] when I need to do I&#x2F;O.<p>95% of localization problems have almost nothing to do with encoding. Encodings are boring. It&#x27;s like arguing over JSON vs YAML. To do I&#x2F;O properly across platforms you <i>may</i> need wrappers for the standard output streams that will handle conversion for you, sure, but... you also need to handle date, time and currency formatting&#x2F;parsing, message formatting, and to enable translations.<p>See [2] regarding Windows:<p>&gt; All of the examples that come with Boost.Locale are designed for UTF-8 and it is the default encoding used by Boost.Locale.<p>Personally I think doing I&#x2F;O as UTF-8 on Windows is the right direction, as Microsoft have been enhancing UTF-8 support in Windows for quite a while now.<p>See[3]:<p>&gt; Until recently, Windows has emphasized &quot;Unicode&quot; -W variants over -A APIs. However, recent releases have used the ANSI code page and -A APIs as a means to introduce UTF-8 support to apps.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;nemtrif&#x2F;utfcpp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nemtrif&#x2F;utfcpp</a><p>[1] <a href="https:&#x2F;&#x2F;www.boost.org&#x2F;doc&#x2F;libs&#x2F;1_76_0&#x2F;libs&#x2F;locale&#x2F;doc&#x2F;html&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;www.boost.org&#x2F;doc&#x2F;libs&#x2F;1_76_0&#x2F;libs&#x2F;locale&#x2F;doc&#x2F;html&#x2F;i...</a><p>[2] <a href="https:&#x2F;&#x2F;www.boost.org&#x2F;doc&#x2F;libs&#x2F;1_76_0&#x2F;libs&#x2F;locale&#x2F;doc&#x2F;html&#x2F;running_examples_under_windows.html" rel="nofollow">https:&#x2F;&#x2F;www.boost.org&#x2F;doc&#x2F;libs&#x2F;1_76_0&#x2F;libs&#x2F;locale&#x2F;doc&#x2F;html&#x2F;r...</a><p>[3] <a href="https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;windows&#x2F;apps&#x2F;design&#x2F;globalizing&#x2F;use-utf8-code-page" rel="nofollow">https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;windows&#x2F;apps&#x2F;design&#x2F;globali...</a>