[Wine] No newline in wine printf with multibyte string

itakingiteasy wineforum-user at winehq.org
Thu May 19 14:37:17 CDT 2011


Hello.

This code: http://paste.pocoo.org/show/391911/ seems to work incorrectly with wine (at least with my 1.3.20-ubuntu6 version), while working well with native linux and native windows. When mingw32-compiled binary is executed under wine it just does not print newline character properly in the end of code, at printf on line #37; if non-ascii characters in printing string are present. This causing printed line to be shared with next PS1 prompt, when executed in wine directly. Here is image illustrating that effect:

[Image: ftp://neverb.net/images/special/screenshot/wine_issue/linux_wine_cmd_exe.png ]

Note also missing extra newline in wine cmd.exe prompt. It should be there as it is in native windows cmd.exe:

[Image: ftp://neverb.net/images/special/screenshot/wine_issue/native_windows.png ]

Possible workarounds:

	 add '\r' before '\n'

	 weed out non-ascii character from printing string

	 use WCHAR instead of wchar_t

	 use wprintf(L"%ls\n"~



But all this workarounds are just sideways, i hope that there is some real solution.

Also, guys from #winehackers noticed that it may be not wine, but compiler or system failure. They suggested to use -fshort-wchar mingw flag, but it changed nothing. Also, workaround using WCHAR also belongs to them.

I would be glad if someone make it clear, why this happens and how to fix it without adding another layer of compatability to the code. 

Thanks.







More information about the wine-users mailing list