This is in Windows, but answers for other operating systems can be handy to others.

Most guides say something to the effect of "hold down the Alt key and type in the code on the keypad". This works fine for decimal codes (like 65 for 'A'), but not for hexadecimal codes (like U+0041 for 'A').

Some applicatons provide other facilities that will allow hexadecimal Unicode character codes to be typed and then transformed. Word allows you to type the code (such as 200f) and then convert it to Unicode by typing Alt-X.

I'm looking for a general method of doing this that will work with the standard input.

This works fine for unicode characters that don't include hex chars A through F. should read: for decimal codes. There are plenty of hexadecimal numbers that don't use A-F. Like 10, which is not ten then...
–
ArjanJul 26 '09 at 7:47

1

That's useless to me when I need to type a u+23AF.
–
WillJul 27 '09 at 12:35

3

My point is: you cannot type things like u+0041 (hex 41, decimal 65) using the numeric keypad either (as one would then need to type 65 rather than 41) -- fileformat.info/info/unicode/char/0041 So, using the Alt-trick works fine for decimal codes, but not for hexadecimal codes.
–
ArjanJul 27 '09 at 13:08

1

@romkyns, I know, I even linked to that Windows hack in my own answer. Odd, I just don't know how to explain any better than I tried already ;-)
–
ArjanDec 28 '09 at 16:51

1

@pipitas, that is exactly my point and I understand fine. (See also the question's editing history.)
–
ArjanJun 26 '10 at 7:31

6 Answers
6

If not, you can use the Windows Calculator Accessory to convert from hexadecimal to decimal. The default mode won't do this: XP and Vista have a "Scientific mode, whereas Win7 has a "Programmer" mode.

Select Hex base, and then type in your hexadecimal number. Then change to Dec base to see the equivalent value in decimal. That's the number you need to type into your numeric keypad while holding down the Alt key.

you can also calculate with set /a in a command window ;-). To convert hex=4321 into decimal, just type set /a 4*16*16*16+3*16*16+2*16+1 and the result will show up as 17185
–
Kurt PfeifleJun 25 '10 at 22:56

1

@Kurt, the command-prompt is (much) more likely to be locked down than the calculator.
–
SynetechJul 8 '12 at 18:10

The method using decimal numbers depends on “input language” (as a Microsoft concept), so the results vary by system and program. For example, in most Windows programs, when the system language has been set to English or other Western language, only Windows Latin 1 characters can be typed this way. Any Alt 0n for n > 255 will then work “modulo 256”, i.e. with n reduced to range 0...255 by dividing by 256 and taking the remainder.
–
Jukka K. KorpelaSep 9 '13 at 5:06

I tested this on Windows XP and
Windows 2003. This method works
regardless of any of your language
settings, but is the most cumbersome
to type:

Press and hold down the Alt key.

Press the + (plus) key on the numeric keypad.

Type the hexidecimal unicode value.

Release the Alt key.

Alas, this appears to require a
registry setting. It was already set
on my computer, but some readers
report that this method didn't work
for them, and this is probably why. If
you don't know what the registry is,
please don't try this. Under
HKEY_CURRENT_USER\Control Panel\Input
Method, set EnableHexNumpad to "1".
If you have to add it, set the type to
be REG_SZ.

You should log off then log on after this registry change, or even reboot.

On Mac OS X: open International in System Preferences, and in Input Menu select "Unicode Hex Input" to add this option to the input menu. Sounds obvious, but this is well hidden in the long list of languages, between Ukrainian and Vietnamese. When selected, hold down Option and type the 4 digit hex code.

Also on OS X: Calculator can be set to Programmer mode (Cmd-3), which allows for entering decimal, octal and hexadecimal codes, which are then displayed as ASCII or Unicode. However, Copy will give one the code, not the character equivalent(s). Anyone?

It also depends where you want to use the special characters. With MS Office apps, you don't have to resort to knowing the ASCII codes for certain characters -- for example, to type a diaresis (i.e., the two dots you see above some characters in words such as naïve), in Word/Outlook/etc you can hit Ctrl + ':' (i.e., Ctrl+Shift+;) followed by 'i'.

Linux (including Qt/KDE applications)

As JMD mentioned, you can hold down Ctrl-Shift, type u1f4a9, and release in order to type U+1F4A9 in GTK+ applications (including GNOME programs, Firefox, Chromium, and LibreOffice, even under KDE). Some programs also support typing in sequence Ctrl-Shift-U, 1, f, 4, a, 9, Enter.

Unfortunately, this doesn't work in Qt applications (including KDE programs, Mathematica, and VLC). For BMP characters, there is a Unicode IBus input method. To enable, open IBus preferences and add the "Other - unicode (m17n)" input method (the two packages ibus-m17n and ibus-qt4 must be installed). When the cursor is in a text area, activate the input method (using the IBus toolbar or the keyboard shortcut). While active, the input method lets you type Ctrl-Shift-U followed by 4 hex digits, to input the corresponding Unicode character. This only works for BMP characters, though.