From: Keith M. <kei...@us...> - 2011-06-27 18:50:17
|
On 25/06/11 04:22, Yongwei Wu wrote: > On 25 June 2011 03:58, Charles Wilson wrote: >> On 6/24/2011 4:17 AM, Yongwei Wu wrote: >> (*) But...if you build the MinGW application with >> -D__USE_MINGW_ANSI_STDIO, then you get an independent implementation of >> the printf functions. Dunno if that would *help* in this case -- I >> doubt our libmingwex.a implementation is multibyte aware. It probably >> just interprets them as single-byte strings. >> >> What happens if you compile your test program with -D__USE_MINGW_ANSI_STDIO? > > My test program is not about using UTF-8 in printf, Chuck didn't mention UTF-8; what makes you believe that we think it to have any bearing on the issue? > so it has nothing > to do with this issue. The exe compiled with -D__USE_MINGW_ANSI_STDIO > no longer has dependency on printf in msvcrt.dll, but still uses > putchar, which is the current issue we are talking about. Well, putchar() is strictly an 8-bit single byte output mechanism, but even when emitting multibyte sequences, that's completely irrelevant; a multibyte sequence emitted one byte at a time via putchar() should still be interpreted correctly by the device driver receiving it. If it isn't, and the device locale matches the locale for which the application has encoded the output stream, then the device driver is broken. You've stated elsewhere in this thread, that the byte sequences appear to be correct, when redirected to a file. This suggests that either: - The locale selected in the application, by setlocale( LC_CTYPE, "" ), does not match the locale configured for the device driver, or - the device driver mishandles the multibyte sequences which are appropriate in its configured locale encoding. I don't see how either of these is a MinGW issue. [*] [*] However, see my reply to Chuck's preceding message, which does identify a potential MinGW issue, albeit one which you seem to want to dismiss out of hand; (admittedly, it may not be strictly relevant to this particular issue, but it still merits attention). -- Regards, Keith. |