AltGr not printing correct chars on Swedish keyboard
I've been using the same keyboard a long time and it's been printing the correct keys. Now, when pressing AltGr it does not produce the correct chars anymore. I've reset the layout as suggested here: Macos detected wrong keyboard layout - Apple Community
This has helped me once before, when all of a sudden macOS lost the key on right of the left key. Now it shows the correct key, and the layout is correct, but not for AltGr.
Here it shows it is detected as an ISO keyboard:
Layout looks correct:
But when I press AltGr, then all chars are wrong:
For example, the key right of the left shift should be the pipe | character.
It's like it's using some "Apple" layout, but there are no viable options. I tried the others as well, but they produce the same result:
If I go the Keyboard Setup Assistant again, the keyboard is detected as "ISO/Macintosh", unlike initially when it was detected as "ISO/IEC 9995 standard keyboard":
What's wrong and how do I fix this?