Entering ZWNJ Zero Width Non-Joiner

  • Hi
    I use ZWNJ (Zero Width Non-Joiner) and I do that A LOT because I am writing a book in a different language. I use an AutoHotKey script to act as a global hotkey for all of my software, including Google Chrome, Word, and Notepad. I have assigned ZWNJ to <Ctrl + Space> and Em-Dash to <Shift + Space>. In NotePad++ Em-Dash works, but ZWNJ does not (and giving administrator privileges to AutoHotKey does not solve the problem). I have had the same problem with other text editing applications as well (namely FocusReader). It appears Notepad++ and FocusReader refuse to accept ZWNJ as input, but they have no problem reading and displaying documents with this character.

    Since the ability to enter ZWNJ is vital, I must find an easy way to use it. Would anyone kindly help me?

  • I have two ideas:

    1. Is it the character or the keyboard shortcut that’s having the problem?

      • Try assigning the AutoHotKey sequence to something different for the ZWNJ insertion, and see if that helps.
      • Alternately: in my Settings > Shortcut Mapper, I see that Main Menu: #58: Function Completion is assigned to that key sequence; yours may be a different number, but you could try to select Function Completion and CLEAR its shortcut, and then try doing the Ctrl+Space shortcut again.
    2. If AHK cannot seem to insert it, even after playing with shortcuts, you might want a PythonScript solution.

      1. create a short script, and save it in the appropriate directory for PythonScripts (in a <executable directory>\plugins\PythonScript\scripts for Machine Scripts, or in %AppData%\Notepad++\plugins\PythonScript\scripts for User Scripts)

        editor.addText( u’\u200c’ )

      2. assign it as a menu item using Plugins > Python Script > Configuration, selecting the appropriate Machine or User scripts, clicking ADD

      3. assign it a shortcut via Settings > Shortcut Mapper > Plugin Commands

    (I verified the PythonScript version worked, though I had to use the PythonScript console to run editor.setRepresentation(u'\u200C', "ZWNJ") to confirm it had really inserted the right character, and editor.clearRepresentation(u'\u200C') once I knew it was really there.)

Log in to reply