4

I open Notepad and then type +2295 holding down the Alt key, then release the Alt key. I save the file with Unicode encoding. However the output is not http://www.fileformat.info/info/unicode/char/2295/index.htm as expected, but this http://www.fileformat.info/info/unicode/char/2248/index.htm instead. What am I doing wrong? Looking for some pointers.

For anyone else stumbling with this: Please note EnableHexNumpad needs to be a new String Type (See the Wiki page linked in the answer)

3

The Wikipedia entry on Unicode input methods lists a necessary prerequisite for this to work:

A prerequisite for this input method is that the registry key HKEY_CURRENT_USER\Control Panel\Input Method contains a string type (REG_SZ) value called EnableHexNumpad, which has the value data 1. Users need to log off/in on Windows 8.1/8.0, Windows 7, and Vista or reboot on earlier systems after editing the registry for this input method to start working.

After I added this registry key on my machine and rebooted, the input works just as advertised.

  • The answer in it says use Notepad++. But I see the same behavior with Notepad++ as well. – user1720897 Dec 10 '15 at 9:32
  • OK, that's interesting. Np++ is definitively Unicode-aware. What locale do you have set? – Boldewyn Dec 10 '15 at 9:49
  • The System and Input Locale is set to en-us – user1720897 Dec 10 '15 at 10:11
  • OK... I'm curious what actually gets saved. May I ask you to get a hex dump of a file where this appears? Basically, open Notepad, type Alt+2295 once, then save file and in cmd.exe run it once through a bin2hex tool like the one from fileformat.info. Then we can see, if it's really (in any of its representations) or something else. – Boldewyn Dec 10 '15 at 10:20
  • 1
    I had already done this. Used HxD to see what the binary representation looks like. When I type Alt+2295 it gets saved as 2248. (Note: I save the file with Unicode Big Endian encoding). However, when I type Alt+2248, the binary looks like 255A – user1720897 Dec 10 '15 at 10:25
2

To answer the question of why this specific value is present:

With the standard input method, decimal numbers are taken mod 256 and then interpreted as the OEM code page* if there is no leading zero, or the ANSI code page if there is a leading zero. So, the steps are:

  • 2295 mod 256 = 247
  • 247 [0xF7] is U+2295 in the OEM code page

Character sets that have U+2295 at this potion are Codepages 437, 737, 770, 772, 774, 860, 861, 862, 863, 864, 865, CWI, and MIK.

(The fact that "2295" and "2248" both start with 22 is an interesting coincidence, nothing more)

* Note: "ANSI Code Page" has little to do with ANSI, except that code page 1252 was based on a draft of what later became ISO 8859-1 [and some of the others had similar origins]. It is the 8-bit character set associated with the current locale, and "OEM Code Page" is another character set associated with the locale, typically the one that was used in MS-DOS in that country.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.