STINNER Victor added the comment:

It looks like the wide character strings (wchar_t*) are misused. For example:

error(RC_NO_PYTHON, L"Requested Python version (%s) ...", &p[1]);
fwprintf(stdout, L"usage: %s ...\n\n", argv[0]);

The %s formatter is for byte string (char*), "%ls" should be used instead.

+       _setmode(_fileno(stdout), _O_WTEXT);

Extract of wprintf() documentation:

"The wprintf() and vwprintf() functions perform wide-character output to 
stdout.  stdout must not be byte oriented;  see  fwide(3)  for more 
information."

So _setmode() or fwide() should be used if I understood correctly. Or wprintf() 
should be replaced with printf() (still with "%ls" format)?

wprintf("%ls") replaces unencodable character string arguments by ? (U+003F), 
whereas printf("%ls") and wprintf("%s") truncates the output at the first 
undecodable/unencodable character:
http://unicodebook.readthedocs.org/en/latest/programming_languages.html#printf-functions-family

So wprintf() is probably better here.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20042>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to