I found the link to Stroustrup's "Learning Standard C++ as a New Language" [edit: from 1998, which explains why I found it kind of familiar to my late 90s run-in with c++...] interesting[2,1]. But then I tried to find out what's the current state of the art for idiomatic, cross-platform text processing (in unicode, probably utf-8) -- and got a little sad.<p>There's still no way to write a ten(ish) line c++ program that reads and writes text, that works both on the windows console, and under OS X/*bsd and Linux?<p>(Lets go crazy, say you have to implement a minimal cat, tac (reverses stdin on stdout) -- and also corresponding echo and ohce (I made that up, something that takes string(s) as input, and outputs the characters reversed (ie: "ohce olé there" outputs "ereht élo").<p>[2][edit] The direct link to Strostrup's paper is:<p><a href="http://stroustrup.com/new_learning.pdf" rel="nofollow">http://stroustrup.com/new_learning.pdf</a><p>code:<p><a href="http://isocpp.org/wiki/faq/newbie#simple-program" rel="nofollow">http://isocpp.org/wiki/faq/newbie#simple-program</a><p>[1]<p>The FAQ briefly touches on Unicode, but it doesn't seem very helpful (to me):
<a href="http://isocpp.org/wiki/faq/cpp11-language-misc" rel="nofollow">http://isocpp.org/wiki/faq/cpp11-language-misc</a>
(search page for unicode)<p>Trying to look for a (simple, generally accepted) solution, I came across:<p><a href="http://www.utf8everywhere.org/" rel="nofollow">http://www.utf8everywhere.org/</a> (If I'm reading this right, it says assume std::string is utf8, but I'm not sure if there are std-lib funtions for doing stuff like getting the index of a glyph, and reversing strings by glyph? And will they work on windows?)<p><a href="http://stackoverflow.com/questions/2037765/what-is-the-optimal-multiplatform-way-of-dealing-with-unicode-strings-under-c" rel="nofollow">http://stackoverflow.com/questions/2037765/what-is-the-optim...</a><p>Which points to: <a href="http://utfcpp.sourceforge.net/" rel="nofollow">http://utfcpp.sourceforge.net/</a> which is the best I'm aware of so far.<p><a href="http://stackoverflow.com/questions/8513249/handling-utf-8-in-c" rel="nofollow">http://stackoverflow.com/questions/8513249/handling-utf-8-in...</a><p><a href="http://stackoverflow.com/questions/402283/stdwstring-vs-stdstring" rel="nofollow">http://stackoverflow.com/questions/402283/stdwstring-vs-stds...</a><p>(Suggest using wstring on Windows and string on Linux -- for simple programs that would effectively mean write to versions, one for each platform ..)