On Tue, 10 May 2011 09:36:05 -0400 Richard Hipp <[email protected]> wrote:
> > > To get the output right, call SetConsoleOutputCP(CP_UTF8) and > > > write > > > UTF8 to stdout. > > > > > > http://msdn.microsoft.com/en-us/library/ms686036(VS.85).aspx > > > > That's not gonna work. > > First, this messes the console code page up--the code page stays at > > what SetConsoleOutputCP() set it to after the process exits which is > > unacceptable. > > Second, outputting a simple sequence of 5 Cyrillic characters > > ("абвгд") encoded in UTF-8 using this method simply does not > > work--puts() outputs one character not related to the set mentioned > > above. A quick demonstration example is attached (I compiled it > > using VC6, my Windows uses code page 866 for console output). > Can you suggest an alternative procedure that will work? Not yet. I don't want to do hand-waving. I'm gonna look at the code when the time permits and at least try to come up with some summary of how I think this problem could be solved. But one thing can be said right away: unfortunately, the *proper* way to support i18n in Windows is to use native Unicode-aware API (FooW-style functions) and not rely on wrappers provided by mingw or Windows POSIX layer. This, again unfortunately, might require abstracting file operations away, so that there are two different sets of functions operating on files--one for POSIX systems and another one for Windows, which first encodes string arguments to UTF-16 and then calls appropriate Unicode Win32 API functions. I suspect this is what Tcl does internally, by the way. _______________________________________________ fossil-users mailing list [email protected] http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

