This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ezio.melotti, vstinner, zart
Date 2013-12-21.14:19:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1387635590.4.0.491137205113.issue20042@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-12-21 14:19:50vstinnersetrecipients: + vstinner, ezio.melotti, zart
2013-12-21 14:19:50vstinnersetmessageid: <1387635590.4.0.491137205113.issue20042@psf.upfronthosting.co.za>
2013-12-21 14:19:50vstinnerlinkissue20042 messages
2013-12-21 14:19:49vstinnercreate