Why do not alt+ASCII give extended ASCII characters



  • In normal notepad and this web browser when I press the alt key and the ASCII code for a character it prints the character.
    for example alt+196 gives ─ do it 3 times and I get a continuous line ───
    In notepad++ this turns in to a minus sign. Some other extended ASCII turn to question marks.

    Why is this?



  • Your encoding is probably set to ANSI. Click encoding on the menu and set the file to UTF-8.



  • Hello, Martin Persson,

    Martin, as my reply is a bit long, if you’re in a hurry, just go to the end of this post, to get the solution :-))


    From your e-mail address, you’re, certainly, a Sweden subject. So, for any text, encoded in ANSI, you, probably, use :

    • The Windows-1252 code-page

    • The old DOS-page OEM 865

    Refer to the two links, below, for additional information :

    https://en.wikipedia.org/wiki/Windows-1252

    https://en.wikipedia.org/wiki/Code_page_865


    Now, we must speak about all the Windows input methods, which, with the combined use of the ALT key and the numeric keypad, allows to enter any character, of the Basic Multilingual Plane, with Unicode code-point between \x{0000} and \{ffff}

    There are four Windows input methods :

    The first TWO most known methods, are :

    • ALT + a number n, from 001 to 255, writes the character, of code n, from the appropriate Windows OEM Code page, on your system ( OEM 865 in your case )

      • Press the ALT key

      • Type a number between 001 and 255, on your numeric keyboard

      • Release the ALT key


    • ALT + a number n, from 0001 to 0255, writes the character, of code n, from the appropriate Windows ANSI code-page, used, on your system, for any NON-Unicode program ( Windows-1252, in your case ). You can, also, see that list, with all these characters, in Notepad++, by clicking on the menu option Edit > Character Panel

      • Press the ALT key

      • Hit the 0 key, FIRST, on your numeric keypad ( IMPORTANT )

      • Then, type a number between 001 and 255, on your numeric keyboard

      • Release the ALT key


    A third Windows input method, very little used, which works, ONLY, in a file, with an Unicode encoding, is :

    • ALT + a number n, from 1 to 31, writes the old symbol of the Control character, of code n

      • Press the ALT key

      • Type a number between 1 and 31, on your numeric keyboard, WITHOUT any leading zero !

      • Release the ALT key

    => You’ll obtain the 31 following characters, below :

    ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼
    

    A fourth and powerful Windows input method can be obtained, after creating a new registry entry, on your system :

    • ALT + the + sign + an hexadecimal number n, from 0000 to ffff, writes the character, of code-point n, from the Basic Multilingual Plane

      • Hold down the ALT key

      • Type the + key, on the NUMERIC keypad

      • Type the hexadecimal code-point of the character, using the 0 to 9 keys, on the numeric keypad AND/OR the normal a to f keys, of the alphanumeric keyboard

      • Release the ALT key

    As said above, in order to be able to use this fourth input method, above, you must modify the registry :

    • Run regedit.exe

    • Preferably, Backup all your registry, first

    • Move to HKEY_CURRENT_USER\Control Panel\Input Method

    • Create a new REG_SZ entry, named EnableHexNumpad

    • Enter, as data, the value 1

    • Valid the dialog

    • Close the registry editor

    • Re-start your system or Log Off/On, from Windows 7 and above


    For some examples of the 4th Input method, refer to the end of my post :

    https://notepad-plus-plus.org/community/topic/11962/alt-codes-not-working/5

    See, also, the link :

    https://notepad-plus-plus.org/community/topic/11962/alt-codes-not-working/2

    Finally, have a look, too, to the Claudia’s post, relative to the registry trick :

    https://notepad-plus-plus.org/community/topic/11609/how-to-enter-character-codes/2


    So, to recapitulate, when you hit ALT + 1, 9, 6, on your numeric keypad ( First Input method )

    you do NOT write a minus sign !. You just writes the BOX DRAWINGS LIGHT HORIZONTAL character, of Unicode code-point \x{2500}, and with code = 196, in the OEM 865 encoding :-))

    To see all the Box Drawing characters, refer to :

    http://www.unicode.org/charts/PDF/U2500.pdf


    If you, really, want to write the EM DASH character, of Unicode code-point \x{2014} and with code = 151, in the Windows-1252 encoding, two solutions :

    • Hit ALT + 0, 1, 5, 1, on your numeric keypad ( Second Input method )

    • Hit ALT + + + 2, 0, 1, 4, on your numeric keypad ( Fourth Input method )

    To see all the General Punctuation characters, refer to :

    http://www.unicode.org/charts/PDF/U2000.pdf

    Best Regards,

    guy038



  • I code 100% in UTF-8


Log in to reply