STINNER Victor <victor.stin...@haypocalc.com> added the comment: > The problem is that the config file is parsed using > GetPrivateProfileString, and the result is then passed to TextOut, > SetDlgItemText, CreateWindow, etc. all of which are defined to accept MBCS > strings. I agree that this can't work correctly in the general case.
These functions are available with an Unicode API: GetPrivateProfileStringW TextOutW SetDlgItemTextW CreateWindowW ... > Changing the GUI functions to operate on Unicode strings is certainly > feasible and a good idea. The main challenge then is the format of the INI > file. IIUC, GetPrivateProfileStringW is willing to process UTF-16 (with > BOM) encoded INI files, but I never tested whether it actually does. bdist_wininst creates a long Unicode string for the INI data, and then encode it explicitly: if isinstance(cfgdata, str): cfgdata = cfgdata.encode("mbcs") So I suppose that replacing "mbcs" by "UTF-16-LE" and add the BOM should be enough. > In porting wininst.exe, it seems tempting to use the TEXT family of APIs. > I'd advise against that, and recommend to explicitly use the *W functions. Do we need to keep backward compatibility if we change the format of the config data? Or wininst-xx.exe are only usable with trailing config data in the .exe file? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10945> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com