[PythonCE] PythonCE, pocketpc and UNICODE

Ulrich Eckhardt eckhardt at satorlaser.com
Mon Aug 8 18:17:01 CEST 2005


Salvatore Russo wrote:
> I am using PythonCE embedded in a C/C++ code to port an open source
> application for my pocketpc. All documentation I read about “porting and
> application to pocketpc” said that we have to convert the application in
> Unicode, with wchat’t and L”blabla” instead of char and “blabla” (and all
> associated string functions str*). 

No. If you look at the specs for the win32 API, you will see that it often 
uses something called TCHAR (or LPTSTR/LPCTSTR). This TCHAR is either char or 
wchar_t, depending on the _UNICODE preprocessor macro. Also, on win9x you 
only have the char versions while on CE you only have the wchar_t versions. 
Windows NT has both, although the char versions are mapped to the wchar_t 
versions. The same can be achieved for win9x with some addon library.

In short: when programming for the win32 API, always use TCHAR like this:
  LPCTSTR str = _T("foo");
other than that, you are free to choose whichever fits your needs.

> But I am a little confused because lot of programs for pocketpc uses also
> char. And all include files for python are specified with char strings. 

I can only guess here, as my Python knowledge is limited, but it is entirely 
possible that the Python API expects Unicode strings in UTF-8 encoding - 
maybe someone else can clarify this topic.

Uli


More information about the PythonCE mailing list