8

I think the only thing I like about Windows is the fact that you can easily enter Unicode characters using the Alt key plus the numeric keypad.

I hate using the Show Emoji & Symbols for this sort of thing as it’s very tedious and I can’t find a way of entering a code I already know.

I know that OS X allows Unicode input using the Unicode Hex Input source, but when enabled I can’t use the option key to enter other useful characters. For example the typographical apostrophe (’) now requires the full unicode (2019) rather than the original keyboard combination.

The question is: is there anything which allows me to easily enter unicode without losing the use of the option key for the rest?

5
  • Normally one would not use the keyboard to make a typographical apostrophe -- instead one would use an app or OS preference setting to generate "smart quotes" etc. Commented Mar 6, 2016 at 13:16
  • 2
    What are examples of things you are using codes for? It may be they are part of the US (ABC) Extended layout. Commented Mar 6, 2016 at 13:18
  • When typing an email or entering on a web form, “smart quote” is not always an option. When writing code, you need "straight quotes" for code, but I use “smart quotes” for text. In any case, other European accented characters are easily entered using the Option key. However the Chinese character cha (茶, \8336) definitely needs Unicode input. On Windows the only way to enter smart quotes is via unicode input. The Mac is normally smarter than that …
    – Manngo
    Commented Mar 7, 2016 at 1:53
  • I would make a copy of the Unicode Hex Input and add states to let me easily do other things I need. Or just learn more hex codes.
    – WGroleau
    Commented Mar 7, 2016 at 4:49
  • If the number of chinese and other characters you need which cannot be made via US or US Extended is not too large, you could make keyboard shortcuts for them in system prefs/keyboard/text (or by using various third party apps which do the same kind of thing). Or use the Unicode hex layout and make keyboard shortcuts for the items you find entering hex codes to be too tedious for. Commented Mar 7, 2016 at 15:28

4 Answers 4

10

The question indicates the OP is not interested in using the Unicode Hex keyboard, but in case that solution does meet your needs, here is how to do it:

On macOS, you first need to add the alternate input "Unicode Hex Input." In the System Preferences >> Keyboard >> Input Sources.

Once that is selected (by clicking that input source on the header bar, all you need to do is type the hex code while holding option.

For example:

å = ⌥ Option00e5

0
3

I made a copy of Unicode Hex Input and added something to it that made the Press and Hold feature work with it. So to put a diacritic on a letter, I hold the key down until a popup appears with the choices of accent marks. But I can still use the hex value for glyphs not supported by that.

Unfortunately, I can't remember exactly how and I can't find the SE posts that told me how to do it. But if you want a copy, download https://HappyHobo.net/UHI+.tbz It unpacks to UHI+.bundle which you can place into ~/Library/Keyboard\ Layouts.  To add it to your input menu, you can find it in the English (not in "Others").

3
  • The earlier SE post is at apple.stackexchange.com/questions/381872/… Commented Sep 30, 2022 at 9:38
  • Is Uncode Hex no longer broken for you? See apple.stackexchange.com/questions/437833/… Commented Sep 30, 2022 at 9:50
  • Unicode Hex Input still (Monterey 12.6) does not support press-and-hold. But I haven't used it since early 2017 when I built (with your help) UHI+ which I have been using ever since. After reading the other article, I switched to Unicode Hex Input and verified that attempting twice to add U+00A0 to the middle of an all-ASCII word resulted in one null (ASCII 00H) being added.
    – WGroleau
    Commented Oct 1, 2022 at 3:57
1

I have written a solution which has worked well for some time.

  1. Open Automator and create a new workflow. I called mine InputUnicode.
  2. Check these settings:
    • Workflow receives no input
    • any application
    • ☑︎ Output replaces selected text
  3. Add the Run JavaScript action.

The JavaScript is:

function run(input, parameters) {
    var app = Application.currentApplication()
    app.includeStandardAdditions = true
    
    var input = app.displayDialog('Unicode HEX:', {
        defaultAnswer: '',
        withIcon: 'note',
        buttons: ['Cancel', 'OK'],
        defaultButton: 'OK'
    }).textReturned

    var text='';
    input.split(' ').forEach(i=>{
        text+=String.fromCodePoint(parseInt(i,16)||63);
    });

    return text;
}

I then assigned a universal shortcut ⌥⌘U:

  1. System Preferences
  2. Keyboard | Shortcuts
  3. Services | InputUnicode (Same as above)

The workflow pops up an input box which allows you to enter one or more space-separated hex codes. These codes are converted into unicode characters, or question marks if not possible, and the result is inserted into the text.

I wrote it in JavaScript because I understand it better than AppleScript, though the API documentation is pretty hard to find.

Annoyingly, the only application this doesn’t work with properly is Firefox, which doesn’t seem to handle the shortcut. However, you can still get to it through the Firefox | Services menu.

Update

I have now added this to Github: https://github.com/manngo/input-unicode.

You end up with a simple popup like this:

enter image description here

1
  • In Automator one needs to choose not a "Workflow" but a "Quick Action". Commented Jan 28 at 11:43
0

Because the unicode keyboard uses ⌥a and ⌥e and ⌥c as part of the hex inputs, it can’t use them for the quick access to the accent keys, so there really is not way around this, however, switching keyboards is very simple. the first step is to simply add the Unicode HEX keyboard to your existing keyboard.

You can leave your keyboard in your normal language setting and hit ⌥⌘-space and type ⌥-2318, tr whatever combo you need, then swap back. This means you can still use ⌥e+e to type é, whilst still having rapid access to the full unicode set.

It sounds more complicated than it is, once you do it a few times it will become second nature.

On newer systems and newer keyboards, the keyboard switch may be tied to the 🌐 key.

Another option is to use Typinator (or perhaps some other similar tool) to set a text expansion for something like ;<HEX> or ><HEX> to expand to the character. Since Typinator supports scripting, you should be able to take the <HEX> you enter, process it, and spit out the unicode character.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .