I have a simple Python application that lives in system tray in Windows XP. The app is using pywin32 (Build 218) for its GUI and runs on Python 2.7.6. Everything was smooth until I tried to create a menu item with Unicode value:
# -*- coding: utf-8 -*-
import win32gui
...
menu = win32gui.CreatePopupMenu()
win32gui.AppendMenu(menu, win32con.MF_STRING, 1, u'Выход')
This menu item renders as five question marks ('?????') while ascii strings work just fine.
If I change the string literal definition for Python 3 and run it on Python 3.3.3, the menu item text displays correctly:
win32gui.AppendMenu(menu, win32con.MF_STRING, 1, 'Выход')
Renders as 'Выход'.
I have to stick with Python 2 as some of the modules the app is using are not compatible with 3.x.x.
Similar issues (#1, #2) on SO with C WinAPI seem to be resolved by defining UNICODE and using L"" string literals. But I don't know how to accomplish this with pywin32. Using utf-16le encoding for the string doesn't help.