| Summary: | SDL_Init() with SDL_INIT_GAMECONTROLLER flag changes locale | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Roman Shuvalov <roman> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | don't know | ||
| Hardware: | x86_64 | ||
| OS: | macOS 10.15 | ||
This is fixed for 2.0.12. You can grab a preview here: http://www.libsdl.org/tmp/SDL-2.0.zip Thanks! Just noticed that locale is also changed on gamepad connect/disconnect and/or SDL_GameControllerOpen/SDL_GameControllerClose. Tested only on old version, don't know if this behavior has already been fixed in 2.0.12 as well as initial bug related to SDL_Init(SDL_INIT_GAMECONTROLLER). Yes, this has been fixed. Please test on the latest code before reopening a bug. Thanks! |
On macOS, calling SDL_Init with SDL_INIT_GAMECONTROLLER flag affects locale. In my case it sets to system locale. Minimal program to reproduce error: ---------------------------------------- #include <stdio.h> #include <locale.h> #include <SDL2/SDL.h> int main(int argc, char** argv) { printf("%.2f | %s\n", 2.78, setlocale(LC_ALL, NULL)); int sdl_init_result = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER); printf("%.2f | %s\n", 2.78, setlocale(LC_ALL, NULL)); } --------------------------------------- Results: 2.78 | C 2,78 | ru_RU.UTF-8 On Linux locale remains āCā, on macOS, as you can see, it changes to ru_RU.UTF-8 and so decimal delimiter changes to ā,ā which is not good.