Repository: nvaccess/nvda

Issue:
when unicode beta support in windows 10 is turned on, add-ons fail to install
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->

### Steps to reproduce:
1. o to the control panel
2. click on regional settings
3. go to the administrative tab.
4. go to the language for non unicode programs settings button
5. check the checkbox use utf-8 for the language support in all the world
6. when prompted, restart your computer.
7. when restarted, try to install any NVDA add-on
It doesn't matter, which NVDA add-on you want to install

### Actual behavior:
nvda produces this error in the log and fails with installation
INFO - core.main (15:24:16.638): 
NVDA initialized 
ERROR - gui.addonGui.AddonsDialog.installAddon (15:24:43.007): 
Error installing  addon bundle from C:\BrailleExtender\BrailleExtender-dev-18.08.06-151459.nvda-addon 
Traceback (most recent call last): 
  File "gui\addonGui.pyc", line 160, in installAddon 
  File "gui\__init__.pyc", line 869, in __init__ 
LookupError: unknown encoding: cp65001 
### Expected behavior:
add-on wshould install normally
### System configuration:
windows 10 17713 russian and windows 10 1806 17134 polish, locale polish, regional settings polish or russian locale with regional set to croatian
#### NVDA Installed/portable/running from source:
installed
#### NVDA version:
alpha-15781,d58e1cd4
#### Windows version:
10.0.17713.1002 or 10.0.17134 april update
#### Name and version of other software in use when reproducing the issue:
n/a
#### Other information about your system:
n/a
### Other questions:

#### Does the issue still occur after restarting your PC?
yes, when the unicode support is enabled
#### Have you tried any other versions of NVDA?
no, but other versions may fail.



Discussion:
Hi,
A temporary fix, works for me...

Create a file with the following content:

```
import globalPluginHandler
import codecs
codecs.register(lambda name: codecs.lookup('utf-8') if name == 'cp65001' else None)
class GlobalPlugin(globalPluginHandler.GlobalPlugin): pass
```

Save the file under `.py` extension (e.g.: "i8599.py") and place it in "%appdata%\nvda\globalPlugins" folder (for a NVDA installed).

I don't know if the approach is good, but if it is, I could submit a fix (for NVDA core).
Hi,

I'm trying to figure out which Windows 10 release included this feature. Also, I think it'd be great if this becomes part of NVDA 2018.3. CC @NVDAEs and other add-on writers.

Thanks.
Hi,

Note: this is present in Windows 10 Version 1803 (April 2018 Update) and later.

Thanks.

Resolving patch:
diff --git a/source/gui/__init__.py b/source/gui/__init__.py
--- a/source/gui/__init__.py
+++ b/source/gui/__init__.py
@@ -35,6 +35,10 @@
 import guiHelper
 import winVersion
 
+# Temporary: #8599: add cp65001 codec
+#            #7105: upgrading to python 3 should fix this issue. See https://bugs.python.org/issue13216
+codecs.register(lambda name: codecs.lookup('utf-8') if name == 'cp65001' else None)
+
 try:
 	import updateCheck
 except RuntimeError:


Test patch: