Repository: nvaccess/nvda

Issue:
Installer fails. Romanian windows display language
Hi everyone!
I found a bug in NVDA. This exists from NVDA 2016.2.
I am using my Windows display language in romanian and, for example, I tried to install NVDA RC2 for 2016.3.
When the instalation process finish, NVDA doesn't tell me that it has been succesfully installed, it displays an error: NVDA instalation failed, please see the log viewer for more informations.
If I use the windows display language in english, NVDA will install succesfully. 
Note: I haven't tried to use other language packages, I speak only romanian and english. I know that at romanian NVDA has this bug and it must be fixed.
Please read this log.
Thank you!

INFO - **main** (00:10:29):
Starting NVDA
INFO - core.main (00:10:30):
Config dir: C:\Users\Florian Ionascu\AppData\Roaming\nvda
INFO - core.main (00:10:30):
NVDA version rc-13528,308e048d
INFO - core.main (00:10:30):
Using Windows version 10.0.10586 workstation
INFO - core.main (00:10:30):
Using Python version 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)]
INFO - core.main (00:10:30):
Using comtypes version 0.6.2
INFO - synthDriverHandler.setSynth (00:10:32):
Loaded synthDriver vocalizer_expressive
INFO - core.main (00:10:32):
Using wx version 3.0.2.0 msw (classic)
INFO - braille.initialize (00:10:32):
Using liblouis version 2.6.5
INFO - braille.BrailleHandler.setDisplayByName (00:10:32):
Loaded braille display driver noBraille, current display has 0 cells.
INFO - brailleInput.initialize (00:10:32):
Braille input initialized
WARNING - core.main (00:10:32):
Java Access Bridge not available
INFO - _UIAHandler.UIAHandler.MTAThreadFunc (00:10:32):
UIAutomation: IUIAutomation3
INFO - _UIAHandler.UIAHandler.MTAThreadFunc (00:10:32):
UIAutomation: IUIAutomation3
INFO - core.main (00:10:34):
NVDA initialized
ERROR - RPC process 11132 (nvda_slave.exe) (00:11:04):
__main__.main:
slave error
Traceback (most recent call last):
  File "nvda_slave.pyw", line 29, in main
  File "installer.pyc", line 391, in install
  File "installer.pyc", line 202, in registerInstallation
  File "installer.pyc", line 56, in createShortcut
  File "comtypes\client\lazybind.pyc", line 163, in caller
  File "comtypes\automation.pyc", line 664, in _invoke
COMError: (-2147352567, 'Exception occurred.', (None, None, None, 0, None))
ERROR - gui.installerGui.doInstall (00:11:04):
Installation failed: 1
INFO - globalCommands.GlobalCommands.script_navigatorObject_devInfo (00:11:21):
Developer info for navigator object:
name: u'Skype\u2122\u200e [42] - florianionascu@hotmail.com'
role: ROLE_PANE
states: STATE_FOCUSABLE
isFocusable: True
hasFocus: False
Python object: <NVDAObjects.IAccessible.IAccessible object at 0x052273F0>
Python class mro: (<class 'NVDAObjects.IAccessible.IAccessible'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 'object'>)
description: None
location: (-32000, -32000, 0, 0)
value: None
appModule: <'skype' (appName u'skype', process ID 18596) at address 52277d0>
appModule.productName: u'Skype'
appModule.productVersion: u'7.26'
TextInfo: <class 'NVDAObjects.NVDAObjectTextInfo'>
windowHandle: 66580
windowClassName: u'tSkMainForm'
windowControlID: 1049957
windowStyle: 919535616
windowThreadID: 7276
windowText: u'Skype\u2122\u200e [42] - florianionascu@hotmail.com'
displayText: u''
IAccessibleObject: <POINTER(IAccessible) ptr=0x7722898 at 4e41990>
IAccessibleChildID: 0
IAccessible event parameters: windowHandle=66580, objectID=-4, childID=0
IAccessible accName: u'Skype\u2122\u200e [42] - florianionascu@hotmail.com'
IAccessible accRole: ROLE_SYSTEM_CLIENT
IAccessible accState: STATE_SYSTEM_FOCUSABLE, STATE_SYSTEM_VALID (1048576)
IAccessible accDescription: None
IAccessible accValue: None



Discussion:
The problem is triggered by the "ț" in the Romanian translation of "NVDA 
web site" ("Locație web NVDA"). Trying to create a shortcut containing 
this character fails, perhaps because it doesn't map to the system's 
ANSI code page. However, I don't understand why ANSI would be used at 
all here; we pas everything as Unicode and there's no reason for Windows 
to convert it. I'll investigate further.

Technical: This can be reproduced with the following code in the Python 
console:
installer.createShortcut(os.path.join("foo", u"Locație web NVDA.lnk"), targetPath=versionInfo.url, prependSpecialFolder="Programs")

```
     MR. Jamie. I belive that I fixed the bug. I retranslated NVDA 
```

sit web from ("Locație web NVDA") to ("Pagina web NVDA"). It's OK now?


That should fix it, yes. Are you happy with this translation? If not, I can try to further investigate why Windows fails when we use this ț character.

```
     I am happy with that translation, so I will leave ("Pagina web 
```

NVDA"). MR. James, thank you for your support.


Okay. In that case, this can be closed once your updated translation is merged. This should be next Friday; you just missed out on the translation sync by a few hours. :)

The new translation landed in ab4385de, so this should now work as expected. Thanks for your work.

Hello. I'm requesting the reopening of this issue because it wasn't fixed. If a user has the Windows display language set to Romanian and wants to install NVDA 2017.3, 2017.2, 2017.1 or 2016.4, the error that have been mentioned in my first comment of this issue still appears.
Cheers,
Florian
Thanks for reopening. I hope this bug will be succesfully fixed.
As noted in https://github.com/nvaccess/nvda/issues/6326#issuecomment-244277462, this should have been fixed by the new translation of "NVDA web site" ("Pagina web NVDA"). If this error is still occurring, it is occurring due to a different message. Please provide a new log showing the installation failing, as the line number in the code where the error occurs is probably different. Thanks.
Hello James, the log is here.

INFO - __main__ (09:18:05.325):
Starting NVDA
INFO - core.main (09:18:07.552):
Config dir: C:\Users\Florian\AppData\Roaming\nvda
INFO - config.ConfigManager._loadConfig (09:18:07.553):
Loading config: C:\Users\Florian\AppData\Roaming\nvda\nvda.ini
INFO - core.main (09:18:08.234):
NVDA version 2017.3
INFO - core.main (09:18:08.236):
Using Windows version 10.0.14393 workstation
INFO - core.main (09:18:08.236):
Using Python version 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)]
INFO - core.main (09:18:08.236):
Using comtypes version 0.6.2
INFO - synthDriverHandler.setSynth (09:18:11.437):
Loaded synthDriver vocalizer_expressive
INFO - core.main (09:18:11.506):
Using wx version 3.0.2.0 msw (classic)
INFO - brailleInput.initialize (09:18:11.657):
Braille input initialized
INFO - braille.initialize (09:18:11.661):
Using liblouis version 3.2.0
INFO - braille.BrailleHandler.setDisplayByName (09:18:11.664):
Loaded braille display driver noBraille, current display has 0 cells.
WARNING - core.main (09:18:11.832):
Java Access Bridge not available
INFO - _UIAHandler.UIAHandler.MTAThreadFunc (09:18:11.859):
UIAutomation: IUIAutomation3
INFO - core.main (09:18:13.612):
NVDA initialized
ERROR - RPC process 920 (nvda_slave.exe) (09:18:43.732):
__main__.main:
slave error
Traceback (most recent call last):
  File "nvda_slave.pyw", line 29, in main
  File "installer.pyo", line 398, in install
  File "installer.pyo", line 208, in registerInstallation
  File "installer.pyo", line 56, in createShortcut
  File "comtypes\client\lazybind.pyo", line 163, in caller
  File "comtypes\automation.pyo", line 664, in _invoke
COMError: (-2147352567, 'Exception occurred.', (None, None, None, 0, None))
ERROR - gui.installerGui.doInstall (09:18:43.900):
Installation failed: 1

Okay. Same problem, even same character, but different message. The problematic message is:

"Explorează dosarul NVDA pentru configurație utilizator"

Note the "ț" in "configurație".

I just checked the translation and there are two other strings that are going to hit this same problem:

1. "Documentation" translates to "Documentație".
2. "Commands Quick Reference" translates to "Referință Rapidă a Comenzilor".

It looks like this happens for any character that can't be encoded using the system ANSI code page:

```
>>> u"\u2022".encode("mbcs")
'\x95'
>>> u"ț".encode("mbcs")
'?'
>>> u"‣".encode("mbcs")
'?'
```

If I try creating the shortcut with either of the latter two, I get an exception.

Even though we pass the string as Unicode, wScript.Shell seems to convert it to ANSI. It seems [others have hit this problem too](https://superuser.com/questions/1129549/ascii-in-powershell-wscript-shell). Note that this is definitely not a file system issue; you can quite happily write a file containing these characters if you use native Unicode:

```
>>> file(u"c:\\users\\jamie\\junk\\jtd‣bar", "w")
<open file u'c:\\users\\jamie\\junk\\jtd\u2023bar', mode 'w' at 0x070573E8>
```

I wonder whether we'll need to switch to an alternative way of creating these shortcuts. We should be able to do this using [IShellLink](https://msdn.microsoft.com/en-us/library/bb774950(v=vs.85).aspx) and friends. IShellLink specifically mentions IShellLinkA and IShellLinkW interfaces, which suggests the latter does explicitly do Unicode. See [this article](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776891(v=vs.85).aspx) for further details. I did a bit of investigation on this in the labyrinth that is MSDN:

1. I found CLSID_ShellLink in ShObjIdl.idl (00021401-0000-0000-C000-000000000046). Unfortunately, it looks like there's no typelib registered for this.
2. There are also dispatch interfaces for most (all?) of this stuff. You access them by using the "shell.application" progId. See [Scriptable Shell Objects](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776890(v=vs.85).aspx) and [ShellLinkObject.Save](https://msdn.microsoft.com/en-us/library/bb773998(v=vs.85).aspx) for details/examples.

CC @MichaelDCurran so he's aware of this. I'd say this is pretty high priority, since it breaks installation for Romanian users.
Hello Jamie!
I just read your comment and I can say that the string "Explore NVDA user configuration directory", translated as "Explorează dosarul NVDA pentru configurație utilizator" can't be translated in other ways in Romanian. The same thing applies to "Documentation (Documentație)" and for "Commands quick reference (Referință rapidă a comenzilor)". However, I found a possible solution for this problem. Maybe you heard that Romanian has 2 keyboard language variants, Romanian standard and Romanian legacy. Before 2016.2, NVDA was translated using the Romanian legacy characters. When Dan pungă has joined the translation team, he replaced the Romanian legacy characters with Romanian standard characters. Well, I want to replace the ț with ţ in the strings mentioned above. This might be a good solution. What do you think about it?
That might work. ţ does seem to be handled correctly by my system's ANSI code page. However, I'm on an English system, so the results might be different. Can you please try the following:

1. Open the NVDA Python console by pressing NVDA+control+z.
2. Paste the following exactly as it appears:
    ```u"ţ".encode("mbcs")```
3. Press enter.
4. Press f6 and copy the resulting output.
the result is

'\xfe'


W dniu 04.09.2017 o 00:10, James Teh pisze:
>
> That might work. ţ does seem to be handled correctly by my system's 
> ANSI code page. However, I'm on an English system, so the results 
> might be different. Can you please try the following:
>
>  1. Open the NVDA Python console by pressing NVDA+control+z.
>  2. Paste the following exactly as it appears:
>     |u"ţ".encode("mbcs")|
>  3. Press enter.
>  4. Press f6 and copy the resulting output.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/6326#issuecomment-326834442>, 
> or mute the thread 
> <https://github.com/notifications/unsubscribe-auth/AKohk4ezHbmC1c-Jp05nW80uvcykDkxKks5seyPCgaJpZM4Jyawa>.
>


Note!

done on the polish system windows 10 64 bit!


W dniu 04.09.2017 o 00:10, James Teh pisze:
>
> That might work. ţ does seem to be handled correctly by my system's 
> ANSI code page. However, I'm on an English system, so the results 
> might be different. Can you please try the following:
>
>  1. Open the NVDA Python console by pressing NVDA+control+z.
>  2. Paste the following exactly as it appears:
>     |u"ţ".encode("mbcs")|
>  3. Press enter.
>  4. Press f6 and copy the resulting output.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/6326#issuecomment-326834442>, 
> or mute the thread 
> <https://github.com/notifications/unsubscribe-auth/AKohk4ezHbmC1c-Jp05nW80uvcykDkxKks5seyPCgaJpZM4Jyawa>.
>


I'm most interested in seeing the result on a system set to Romanian, as
that is where this bug will strike. Thanks for testing, though, @zstanecic!

is that the expected behavior or is it correct?


W dniu 04.09.2017 o 01:15, James Teh pisze:
> I'm most interested in seeing the result on a system set to Romanian, as
> that is where this bug will strike. Thanks for testing, though, 
> @zstanecic!
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/6326#issuecomment-326837960>, 
> or mute the thread 
> <https://github.com/notifications/unsubscribe-auth/AKohkwVtyX4wUbkURXQp4rjdWlvD2r3sks5sezMsgaJpZM4Jyawa>.
>


That should be fine. The really important thing is that the output doesn't
return "?", as that means it can't be encoded, which will mean that the
code in question will fail. Having said that, the output will also
determine what character actually gets included in the file name. Without
knownig more about how Windows handles Romanian, I can't diagnose that from
here, but at the very least, a strange character in the file name is better
than installation failing.

to cite your previous sentence:

a strange character in the file name is better
than installation failing.

I don’t agree, as the user using the braille display or speech 
synthesis, should get the accurate information


W dniu 04.09.2017 o 01:30, James Teh pisze:
> That should be fine. The really important thing is that the output doesn't
> return "?", as that means it can't be encoded, which will mean that the
> code in question will fail. Having said that, the output will also
> determine what character actually gets included in the file name. Without
> knownig more about how Windows handles Romanian, I can't diagnose that 
> from
> here, but at the very least, a strange character in the file name is 
> better
> than installation failing.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/6326#issuecomment-326838619>, 
> or mute the thread 
> <https://github.com/notifications/unsubscribe-auth/AKohkxNb4SVp7tZn8RYD-aLTODOz8tTwks5sezaagaJpZM4Jyawa>.
>


Of course they should. However, I think a user would prefer one incorrect
character over NVDA failing to install altogether (and thus being
completely unusable). I'm not suggesting we don't want to fix the problem
completely. I'm suggesting that if we can at least get it installing, even
at the cost of a broken character, that is better than the current
situation. The proper fix is going to require a lot more time and I'd
rather Romanian users weren't waiting for months to be able to install NVDA.

Well, there is another workaround, but it needs a separate issue:

allow user at the start of installation to select language,

and install NVDA in english

and then swithc nvda to romanian.

but, we should see, how nvda handles this on the romanian window


W dniu 04.09.2017 o 02:07, James Teh pisze:
> Of course they should. However, I think a user would prefer one incorrect
> character over NVDA failing to install altogether (and thus being
> completely unusable). I'm not suggesting we don't want to fix the problem
> completely. I'm suggesting that if we can at least get it installing, even
> at the cost of a broken character, that is better than the current
> situation. The proper fix is going to require a lot more time and I'd
> rather Romanian users weren't waiting for months to be able to install 
> NVDA.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/6326#issuecomment-326841152>, 
> or mute the thread 
> <https://github.com/notifications/unsubscribe-auth/AKohk6-ZLZy1_nQ8SAiM-KvOLe_CI8Gvks5sez9CgaJpZM4Jyawa>.
>


You could already do that by changing the NVDA language from General
Settings. However, that will result in the NVDA program icons, etc. being
created in English, which isn't a good solution. Regardless, let's keep
this issue focused on the actual problem. Thanks.

Hello Jamie, the result is: 't'
Note: My system is set to Romanian.
so, florian, you have the t without diacritic, wich should be present


W dniu 09.09.2017 o 11:02, florianionascu7 pisze:
>
> Hello Jamie, the result is: 't'
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/6326#issuecomment-328264726>, 
> or mute the thread 
> <https://github.com/notifications/unsubscribe-auth/AKohk73tVrDBAorIjCEQ4du-SXy_pKPSks5sglQ7gaJpZM4Jyawa>.
>


I think this means that if you translate it in this way, users will end up
with a "t" in the shortcut name instead of the accented t. Is that
acceptable in the short term? To put it another way, is that better for
your users than not being able to install NVDA at all? Long term, it'd
obviously be better to fix this properly, but that's not likely right now.

Will switch to python3 solve this issue?


W dniu 09.09.2017 o 12:51, James Teh pisze:
> I think this means that if you translate it in this way, users will end up
> with a "t" in the shortcut name instead of the accented t. Is that
> acceptable in the short term? To put it another way, is that better for
> your users than not being able to install NVDA at all? Long term, it'd
> obviously be better to fix this properly, but that's not likely right now.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/6326#issuecomment-328269727>, 
> or mute the thread 
> <https://github.com/notifications/unsubscribe-auth/AKohk1SsoBIYZ7ew5Q3Oy0FzimfqKdc0ks5sgm2hgaJpZM4Jyawa>.
>


This might be a solution.
No, switching to Python 3 won't solve this, and that's a year or two away anyway.

Hello, I've installed the latest master Snapshot and I've received the same error. This is the log:
INFO - __main__ (16:32:37.033):
Starting NVDA
INFO - core.main (16:32:37.710):
Config dir: C:\Users\Florian\AppData\Roaming\nvda
INFO - config.ConfigManager._loadConfig (16:32:37.711):
Loading config: C:\Users\Florian\AppData\Roaming\nvda\nvda.ini
INFO - core.main (16:32:38.114):
NVDA version master-14426,4138af14
INFO - core.main (16:32:38.115):
Using Windows version 10.0.15063 workstation
INFO - core.main (16:32:38.115):
Using Python version 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)]
INFO - core.main (16:32:38.115):
Using comtypes version 0.6.2
INFO - synthDriverHandler.setSynth (16:32:39.545):
Loaded synthDriver vocalizer_expressive
INFO - core.main (16:32:39.545):
Using wx version 3.0.2.0 msw (classic)
INFO - brailleInput.initialize (16:32:39.545):
Braille input initialized
INFO - braille.initialize (16:32:39.545):
Using liblouis version 3.2.0
INFO - braille.BrailleHandler.setDisplayByName (16:32:39.545):
Loaded braille display driver noBraille, current display has 0 cells.
WARNING - core.main (16:32:39.690):
Java Access Bridge not available
INFO - _UIAHandler.UIAHandler.MTAThreadFunc (16:32:39.707):
UIAutomation: IUIAutomation3
INFO - core.main (16:32:42.174):
NVDA initialized
ERROR - RPC process 10592 (nvda_slave.exe) (16:34:26.200):
__main__.main:
slave error
Traceback (most recent call last):
  File "nvda_slave.pyw", line 29, in main
  File "installer.pyc", line 398, in install
  File "installer.pyc", line 212, in registerInstallation
  File "installer.pyc", line 56, in createShortcut
  File "comtypes\client\lazybind.pyc", line 163, in caller
  File "comtypes\automation.pyc", line 664, in _invoke
COMError: (-2147352567, 'Exception occurred.', (None, None, None, 0, None))
ERROR - gui.installerGui.doInstall (16:34:26.351):
Installation failed: 1
INFO - synthDrivers.espeak.SynthDriver.__init__ (16:36:11.148):
Using eSpeak NG version 1.49.1 dev
INFO - synthDriverHandler.setSynth (16:36:11.453):
Loaded synthDriver espeak

Hello. I installed the latest master snapshot and I noticed that the problem has been fixed succesfully. Thank you all for the support.
Well, this issue can be closed now and can be added to 2017.4 milestone. Finally, I can say that I enjoy this bug was fixed after a long discussion time.
Closing, as requested in https://github.com/nvaccess/nvda/issues/6326#issuecomment-335114271
Hello! Please re-open this issue, as it re-occured in NVDA 2019.3. Here's the log.

```
INFO - __main__ (14:57:20.824) - MainThread (9204):
Starting NVDA version 2019.3
INFO - core.main (14:57:22.161) - MainThread (9204):
Config dir: C:\Users\Florian\AppData\Roaming\nvda
INFO - config.ConfigManager._loadConfig (14:57:22.161) - MainThread (9204):
Loading config: C:\Users\Florian\AppData\Roaming\nvda\nvda.ini
INFO - core.main (14:57:22.271) - MainThread (9204):
Using Windows version 10.0.18363 workstation
INFO - core.main (14:57:22.271) - MainThread (9204):
Using Python version 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 14 2019, 23:09:19) [MSC v.1916 32 bit (Intel)]
INFO - core.main (14:57:22.271) - MainThread (9204):
Using comtypes version 1.1.7
INFO - core.main (14:57:22.271) - MainThread (9204):
Using configobj version 5.1.0 with validate version 1.0.1
INFO - synthDriverHandler.setSynth (14:57:25.758) - MainThread (9204):
Loaded synthDriver vocalizer
INFO - core.main (14:57:25.761) - MainThread (9204):
Using wx version 4.0.3 msw (phoenix) wxWidgets 3.0.5 with six version 1.12.0
INFO - brailleInput.initialize (14:57:25.771) - MainThread (9204):
Braille input initialized
INFO - braille.initialize (14:57:25.771) - MainThread (9204):
Using liblouis version 3.10.0
INFO - braille.initialize (14:57:25.800) - MainThread (9204):
Using pySerial version 3.4
INFO - braille.BrailleHandler.setDisplayByName (14:57:25.822) - MainThread (9204):
Loaded braille display driver noBraille, current display has 0 cells.
INFO - core.main (14:57:26.764) - MainThread (9204):
Java Access Bridge support initialized
INFO - _UIAHandler.UIAHandler.MTAThreadFunc (14:57:26.833) - _UIAHandler.UIAHandler.MTAThread (1004):
UIAutomation: IUIAutomation6
INFO - core.main (14:57:27.527) - MainThread (9204):
NVDA initialized
ERROR - RPC process 2196 (nvda_slave.exe) (14:57:47.450) - Dummy-2 (9544):
__main__.main:
slave error
Traceback (most recent call last):
  File "nvda_slave.pyw", line 47, in main
  File "installer.pyc", line 454, in install
  File "installer.pyc", line 272, in registerInstallation
  File "installer.pyc", line 67, in createShortcut
  File "comtypes\client\lazybind.pyc", line 182, in caller
  File "comtypes\automation.pyc", line 729, in _invoke
_ctypes.COMError: (-2147352567, 'Exception occurred.', (None, None, None, 0, None))
ERROR - gui.installerGui.doInstall (14:57:47.595) - MainThread (9204):
Installation failed: 1
```

What's the problem?
Re-opening as requested.

Resolving patch:
diff --git a/source/installer.py b/source/installer.py
--- a/source/installer.py
+++ b/source/installer.py
@@ -249,30 +249,148 @@ def registerInstallation(installDir,startMenuFolder,shouldCreateDesktopShortcut,
 		config._setStartOnLogonScreen(startOnLogonScreen)
 	NVDAExe=os.path.join(installDir,u"nvda.exe")
 	slaveExe=os.path.join(installDir,u"nvda_slave.exe")
+	try:
+		_updateShortcuts(NVDAExe, installDir, shouldCreateDesktopShortcut, slaveExe, startMenuFolder)
+	except Exception:
+		log.error("Error while creating shortcuts", exc_info=True)
+	registerAddonFileAssociation(slaveExe)
+
+
+def _createShortcutWithFallback(
+		path,
+		targetPath=None,
+		arguments=None,
+		iconLocation=None,
+		workingDirectory=None,
+		hotkey=None,
+		prependSpecialFolder=None,
+		fallbackHotkey=None,
+		fallbackPath=None,
+):
+	"""Sometimes translations are used (for `path` or `hotkey` arguments) which include unicode characters
+	which cause the createShortcut method to fail. In these cases, try again using the English string if it is
+	provided via the `fallbackHotkey` / `fallbackPath` arguments.
+	"""
+	try:
+		createShortcut(
+			path,
+			targetPath,
+			arguments,
+			iconLocation,
+			workingDirectory,
+			hotkey,
+			prependSpecialFolder
+		)
+	except Exception:
+		if hotkey is not None and fallbackHotkey is not None:
+			log.error(f"Error creating {path}. With hotkey ({hotkey}). Trying fallback hotkey: {fallbackHotkey}")
+			_createShortcutWithFallback(
+				hotkey=fallbackHotkey,
+				fallbackHotkey=None,
+				path=path,
+				fallbackPath=fallbackPath,
+				targetPath=targetPath,
+				arguments=arguments,
+				prependSpecialFolder=prependSpecialFolder,
+			)
+		elif fallbackPath is not None:
+			log.error(f"Error creating {path}. Trying without translation of filename, instead using: {fallbackPath}")
+			_createShortcutWithFallback(
+				path=fallbackPath,
+				fallbackPath=None,
+				targetPath=targetPath,
+				arguments=arguments,
+				hotkey=hotkey,
+				prependSpecialFolder=prependSpecialFolder,
+				fallbackHotkey=fallbackHotkey,
+			)
+		else:
+			log.error(
+				f"Error creating {path}, no mitigation possible. "
+				f"Perhaps controlled folder access is active for this directory."
+			)
+
+
+def _updateShortcuts(NVDAExe, installDir, shouldCreateDesktopShortcut, slaveExe, startMenuFolder) -> None:
 	if shouldCreateDesktopShortcut:
-		# #8320: -r|--replace is now the default. Nevertheless, keep creating
-		# the shortcut with the now superfluous argument in case a downgrade of
-		# NVDA is later performed.
 		# Translators: The shortcut key used to start NVDA.
 		# This should normally be left as is, but might be changed for some locales
 		# if the default key causes problems for the normal locale keyboard layout.
 		# The key must be formatted as described in this article:
 		# http://msdn.microsoft.com/en-us/library/3zb1shc6%28v=vs.84%29.aspx
-		createShortcut(u"NVDA.lnk",targetPath=slaveExe,arguments="launchNVDA -r",hotkey=_("CTRL+ALT+N"),workingDirectory=installDir,prependSpecialFolder="AllUsersDesktop")
-	createShortcut(os.path.join(startMenuFolder,"NVDA.lnk"),targetPath=NVDAExe,workingDirectory=installDir,prependSpecialFolder="AllUsersPrograms")
+		hotkeyTranslated = _("CTRL+ALT+N")
+
+		# #8320: -r|--replace is now the default. Nevertheless, keep creating
+		# the shortcut with the now superfluous argument in case a downgrade of
+		# NVDA is later performed.
+		_createShortcutWithFallback(
+			path="NVDA.lnk",
+			targetPath=slaveExe,
+			arguments="launchNVDA -r",
+			hotkey=hotkeyTranslated,
+			fallbackHotkey="CTRL+ALT+N",
+			workingDirectory=installDir,
+			prependSpecialFolder="AllUsersDesktop",
+		)
+
+	_createShortcutWithFallback(
+		path=os.path.join(startMenuFolder, "NVDA.lnk"),
+		targetPath=NVDAExe,
+		workingDirectory=installDir,
+		prependSpecialFolder="AllUsersPrograms"
+	)
+
 	# Translators: A label for a shortcut in start menu and a menu entry in NVDA menu (to go to NVDA website).
-	createShortcut(os.path.join(startMenuFolder,_("NVDA web site")+".lnk"),targetPath=versionInfo.url,prependSpecialFolder="AllUsersPrograms")
+	webSiteTranslated = _("NVDA web site")
+	_createShortcutWithFallback(
+		path=os.path.join(startMenuFolder, webSiteTranslated + ".lnk"),
+		fallbackPath=os.path.join(startMenuFolder, "NVDA web site.lnk"),
+		targetPath=versionInfo.url,
+		prependSpecialFolder="AllUsersPrograms"
+	)
+
 	# Translators: A label for a shortcut item in start menu to uninstall NVDA from the computer.
-	createShortcut(os.path.join(startMenuFolder,_("Uninstall NVDA")+".lnk"),targetPath=os.path.join(installDir,"uninstall.exe"),workingDirectory=installDir,prependSpecialFolder="AllUsersPrograms")
+	uninstallTranslated = _("Uninstall NVDA")
+	_createShortcutWithFallback(
+		path=os.path.join(startMenuFolder, uninstallTranslated + ".lnk"),
+		fallbackPath=os.path.join(startMenuFolder, "Uninstall NVDA.lnk"),
+		targetPath=os.path.join(installDir, "uninstall.exe"),
+		workingDirectory=installDir,
+		prependSpecialFolder="AllUsersPrograms"
+	)
+
 	# Translators: A label for a shortcut item in start menu to open current user's NVDA configuration directory.
-	createShortcut(os.path.join(startMenuFolder,_("Explore NVDA user configuration directory")+".lnk"),targetPath=slaveExe,arguments="explore_userConfigPath",workingDirectory=installDir,prependSpecialFolder="AllUsersPrograms")
+	exploreConfDirTranslated = _("Explore NVDA user configuration directory")
+	_createShortcutWithFallback(
+		path=os.path.join(startMenuFolder, exploreConfDirTranslated + ".lnk"),
+		fallbackPath=os.path.join(startMenuFolder, "Explore NVDA user configuration directory.lnk"),
+		targetPath=slaveExe,
+		arguments="explore_userConfigPath",
+		workingDirectory=installDir,
+		prependSpecialFolder="AllUsersPrograms"
+	)
+
 	# Translators: The label of the NVDA Documentation menu in the Start Menu.
-	docFolder=os.path.join(startMenuFolder,_("Documentation"))
+	docFolder = os.path.join(startMenuFolder, _("Documentation"))
+
 	# Translators: The label of the Start Menu item to open the Commands Quick Reference document.
-	createShortcut(os.path.join(docFolder,_("Commands Quick Reference")+".lnk"),targetPath=getDocFilePath("keyCommands.html",installDir),prependSpecialFolder="AllUsersPrograms")
+	commandsRefTranslated = _("Commands Quick Reference")
+	_createShortcutWithFallback(
+		path=os.path.join(docFolder, commandsRefTranslated + ".lnk"),
+		fallbackPath=os.path.join(docFolder, "Commands Quick Reference.lnk"),
+		targetPath=getDocFilePath("keyCommands.html", installDir),
+		prependSpecialFolder="AllUsersPrograms"
+	)
+
 	# Translators: A label for a shortcut in start menu to open NVDA user guide.
-	createShortcut(os.path.join(docFolder,_("User Guide")+".lnk"),targetPath=getDocFilePath("userGuide.html",installDir),prependSpecialFolder="AllUsersPrograms")
-	registerAddonFileAssociation(slaveExe)
+	userGuideTranslated = _("User Guide")
+	_createShortcutWithFallback(
+		path=os.path.join(docFolder, userGuideTranslated + ".lnk"),
+		fallbackPath=os.path.join(docFolder, "User Guide.lnk"),
+		targetPath=getDocFilePath("userGuide.html", installDir),
+		prependSpecialFolder="AllUsersPrograms"
+	)
+
 
 def isDesktopShortcutInstalled():
 	wsh=_getWSH()


Test patch: