Windows regional format breaks decimal fields and project files with "Default" language set

When selecting a language explictly in KiCad, wxLocale sets the locale of the CRT (printf/scanf) according to the wxWidgets language database. However, when initializing with wxLANGUAGE_DEFAULT, wxLocale does not touch the CRT locale and only detects the system language. For this wxWidgets calls GetUserDefaultUILanguage() and then looks in its database for that language. This database entry is now used by wxWidget to guess the decimal separator of the CRT.

However in Windows it is possible to set the UI languge to English, but also set a regional format for a local date format, currency and decimal separator:
Example: English(Sweden) for English with , as decimal separator
image

Now, when "Default" language is selected in KiCad, the CRT is set to use the , separator but wxWidgets assumes that printf/scanf uses the . separator.

This leads to at least two major problems:

  1. The angle field of the arc properties dialog is broken because input validation only allows . characters but number parsing needs ,
  2. Serializing project settings breaks for colors: rgba(11, 22, 33, 0.75) is written as rbga(11, 22, 33, 0,75) which silently fails parsing at the next project open and defaults to rgba(0, 0, 0, 1.0). This effectively turns all instances of COLOR4D::UNSPECIFIED into black after one save/load cycle.

KiCad Version

Application: KiCad (64-bit)

Version: (5.99.0-10772-g6919d12c70), release build

Libraries:
	wxWidgets 3.1.5

Platform: Windows 10 (build 19042), 64-bit edition, 64 bit, Little endian, wxMSW

	wxWidgets: 3.1.5 (wchar_t,STL containers)
	Boost: 1.75.0
	OCC: 7.5.0
	Curl: 7.74.0-DEV
	ngspice: 34
	Compiler: Visual C++ 1928 without C++ ABI

Build settings:
	KICAD_USE_OCC=ON
	KICAD_SPICE=ON
Edited by David Beinder