Unknown encoding dialog in Windows

Hi,

On our project, from time to time, some users on Windows report that just before the display of a new window they receive a message dialog “unknown encoding”, which proposes them to pick a font. If I understand correctly, whatever they do, the window eventually is displayed fine. See such dialog:
image

I have a feeling that it comes from the use XRC. However, I’ve now made sure to remove all “UTF-8” in XRC, and it still appears. Frustratingly, we can’t reproduce it.
Any idea what is causing this dialog box, and how can we avoid it?

Cheers,
Éric

That message is coming from a couple places in this C++ module: wxWidgets/fontmap.cpp at 26890407699b000102bc63d4148e7c39dcebe8d6 · wxWidgets/wxWidgets · GitHub

The font mapper is intended to do things like map between logical font names, or specified font encodings, and the actual fonts installed on the system. It finds matches or close matches and gives that font instead of what may have been asked for. If there isn’t a close match then it shows the dialog.

You are probably correct that it is related to XRC, as it does use a wxFontMapper in that code, but I don’t think it has anything to do with the encoding of the XRC file itself. See wxWidgets/xmlres.cpp at 26890407699b000102bc63d4148e7c39dcebe8d6 · wxWidgets/wxWidgets · GitHub

I can dig further into this another time if needed, but hopefully this will give you some clues about workaround ideas to try.

Thanks a lot Robin. I had not dare searching in the wxWidget source code. It’s a little clearer what’s happening now.
A follow-up question: From what I understand, the font mapper stores the font choice in a “config” file. However, I have a hard time locating this file. I’d like to be able to delete it, so that it’s easier to reproduce the issue more than once per Windows installation. Any idea about which folder it should be in on Windows 10?

To clarify, the encoding issue is not from the XRC xml encoding, but in the XRC, the font object has subtags, one of which is “encoding”. Removing this tag (and so letting the font mapper use the default encoding) helps a lot. I’ve just found out that there were still two objects with such tag in our XRC file. I am quite optimistic that deleting them will do the trick.

Cheers,
Éric

The config file mentioned is probably whatever is set as the default config object. IIRC on Windows it will use the registry by default, and wx.FileConfig will be used on other platforms. The registry keys or config file name is based on the application’s appname and vendorname if they are set.

You can set a new default config object using wx.ConfigBase.Set