[New-bugs-announce] [issue4051] use of TCHAR under win32

Ulrich Eckhardt report at bugs.python.org
Mon Oct 6 12:28:46 CEST 2008

New submission from Ulrich Eckhardt <eckhardt at satorlaser.com>:

In several places, Python is using TCHAR-based win32 APIs which has 
several consequences:
1. The actually used function depends on the _UNICODE macro, while the 
using code often assumes that this macro is not defined. That means 
that not only the code changes when the macro is defined but that it 
simply breaks.
2. Using the ANSI-variants of functions causes overhead when a Unicode 
string has to be transcoded and possibly data loss, because the ANSI 
encoding can't represent the full Unicode range. Note that I'm 
assuming an NT based system (i.e. NT, win2k etc), because the systems 
where the ANSI encoding is native (win9x, ME(?) etc) have been dropped 
from the supported platforms.
3. The main reason for me wanting a build independent of TCHAR is a 
port to MS Windows CE, which doesn't support the ANSI encoding at all. 
This means that a TCHAR-clean build for desktop win32 is a necessary 
part of the port to CE, but even without the port it would be useful 
to skip the conversion overhead and at the same time gain 
functionality. Concerning the CE port, see this thread as a reference:

Note: I'm adding this tracker item mainly in order to attach patches 
for review, so they don't get lost like it's possible on the 

components: Windows
messages: 74363
nosy: eckhardt
severity: normal
status: open
title: use of TCHAR under win32
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list