Use locale.getpreferredencoding rather than locale.getlocale as latter can fail if Python doesn't know the locale (#11384)
* Use locale.getpreferredencoding rather than locale.getlocale as latter can fail if Python doesn't know the locale
Fixes https://github.com/nvaccess/nvda/issues/11155
* Review actions