This approach could present problems for some functions on Win98/ME. A lot of the unicode functions are implemented as stubs, returning some form of "not implemented". If an application was passing unicode to a function and it was getting converted to character in order to call the *A form of the function (as many do now), it would suddenly stop working if the *W function was called instead.
One solution might be to do a separate release for 98, linking all the projects against unicows.lib, which translates all the *W calls to the equivalent *A function. However, this would require anyone using Pywin32 on Win98 to have unicows.dll installed. (and would also be more work for Mark) Of course, you could always just drop support for 98/ME. (hint hint) Roger Mark Hammond wrote: >> ok. I have no patches so far as of now - maybe later. Played with >> Heller's ctypes for my urgent needs. That works correct with unicode >> like this: >> >> >>> import ctypes >> >>> >> ctypes.windll.user32.MessageBoxW(0,u'\u041f\u043e\u0448\u0443\u043 >> a.txt',0,0) >> 1 > > In general, the "ascii" win32 functions will actually take MBCS encoded > strings. So: > >>>> import win32api >>>> win32api.MessageBox(0, u"Here is a \xa9 symbol".encode("mbcs"), >>>> "title", > 0) > > Displays a message box with a copyright symbol. You should find this true > for pretty much all win32 functions. Many functions will actually still > allow you to specify a unicode string directly and automatically convert > to > MBCS, but MessageBox doesn't get this behaviour as it still uses > PyArg_ParseTuple with the 's' format char. (Not surprisingly, MessageBox > was one of the very first functions added to win32api, which was the very > first win32 module :) > > This only falls apart when you need to represent a unicode character not > in > the user's codepage, but that is rare. > > As you mention, the correct thing for this function to do is automatically > use the W function when either of the string args are unicode - as usual, > patches gratefully accepted :) > > Cheers, > > Mark > > > _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32