JoystickGremlin
JoystickGremlin copied to clipboard
Non US system locale settings can cause profile decoding errors
Attempting to load a profile causes the error below.
Only thing I can think of that might be related, since it complains about unicode, is that I have the Language for non-unicode programs set to Japanese in the Region settings.
This definitely sounds like an issue related to language settings. In that part of the code Gremlin tries to save the profile to a file but fails because it can't handle a particular character. Did you by chance have text entered in description or similar fields using Japanese characters?
There are no japanese characters. I only very rarely change the input mode in windows to japanese, so I'm pretty confident it was on english while I was making this. I think the only text I entered that still exist in the profile are the names of the modes. I used the button_to_hat plugin at one point, which would have had some text entries, but I removed it after I decided it wouldn't work for my setup.
Also, I notice it seems to be checking if the profile has changed in the error, and it happens even if I don't change anything or save it immediately before trying to load.
I'll attach the profile so you can take a closer look at it, there's nothing particularly fancy about it. It's for a Saitek X45 stick and throttle.
I tried to get the error to happen on my machine with your profile though sadly nothing broke. Looking at the profile itself there also isn't anything in there that should cause problems text wise. I'm not entirely sure why Gremlin decided to use CP932 instead of utf-8 as it actually is instructed to read the file.
I'll have to see if I can coax my Windows into failing in a similar way, as it seems to be related to the language settings, as CP932 is a Japanese codepage. It also doesn't seem to be an issue of actual Japanese characters as I could save and load those without issues.
Apparently there's a beta option to use UTF-8 with japanese where you change non-unicode language that wasn't there last time I looked:
I turned it on and quickly tried loading a profile and it worked fine. I'll mess with it more later and let you know if it breaks again, but at least that seems to work. No idea if that will cause problems running japanese programs, but I haven't been using any lately anyways.
When I get to redo some of those encoding bits I'll try to use a different system locale setting to trigger the error and then see if there is a decent way around it to prevent that from happening in the future.
same issue
Attempting to load a profile causes the error below.
I am using Korean Language Windows 10. There is no Korean language in the path where the program is installed.
I had same problem and solved. Adding option 'encoding="utf-8"' to two open function in _has_profile_changed works fine.
Python's open function without encoding option regards the file as written in system encoding. Some multibyte encodings, such as CP932, has the character code overlapped with UTF8 BOM byte sequence. Then, python tries to convert BOM sequence to CP932 and glitched.
Checked:
- [ ] Beta: Use Unicode UTF-8 for worldwide language support
Fix this for me