Keyboard alt codes

Started by kphoger, May 02, 2013, 11:43:22 AM

Previous topic - Next topic

Duke87

Quote from: agentsteel53 on May 03, 2013, 12:39:45 PM
but I remember in the late 80s, playing around with Alt codes and discovering that, effectively, they are modulo 256.  so Alt+288 was the same as Alt+32 (a space).  so, in some contexts, it should be possible to type "Alt+3.141592..." and, upon release of Alt, yield a character.

This is definitely not still the case. I remember having experimented with it several years back that the codes were four digits and continuous all the way from 0 to 9999. Many of those numbers revealed unrecognized characters (at least to the Arial Unicode MS font in Wordpad on my particular computer), but there was definitely stuff at higher numbers that's not there at lower numbers.

What's recognized definitely varies - I have since making my character dump file changed computers twice and on my current computer many of the previously recognized characters have turned to question marks in boxes.
I have also by other means discovered characters that I didn't find trying every code from 0 to 9999, so there are also characters out there that cannot be typed by this method.


The complete unicode library of characters has codes that are five digits hexadecimal, so there are a total of 65,536 potential characters out there.
If you always take the same road, you will never see anything new.


DTComposer

Quote from: kphoger on May 02, 2013, 11:43:22 AM
½ is alt+0189

For me ½ is alt+171. It's one of the few that I remember and use.

(however, I now see that alt+0189 works as well)

Scott5114

On Linux, there are no Alt codes. Instead, you can designate a key as a "Compose key" (I use right alt, but most people use one of the useless Windows keys or that strange menu key). You press it once and then type whatever symbols the desired character is composed of. So to get a euro symbol, you type Compose+C+=, to get Ã' you type Compose+N+~, to get É you type Compose+E+'.

Compose+C+C+C+P gives you ☭.
uncontrollable freak sardine salad chef

Alps

Quote from: DTComposer on May 04, 2013, 03:34:27 PM
Quote from: kphoger on May 02, 2013, 11:43:22 AM
½ is alt+0189

For me ½ is alt+171. It's one of the few that I remember and use.

(however, I now see that alt+0189 works as well)
0189 is better because you can get ¼ and ¾ on either side of it easily.

J N Winkler

Quote from: 1995hoo on May 03, 2013, 10:40:31 AMThe last time I saw a keyboard with "AltGr" was in the British Airways "Terraces" lounge on my last connection through Heathrow a few years ago (not coincidentally, the first time I saw a keyboard with "AltGr" was in the Concorde Room at Heathrow in 2003). I had a horrible time typing on that thing, just a few too many differences from a US-spec keyboard for me to type comfortably.

If you actually lived with and used a UK-spec keyboard for a short while (say, one month), you would rapidly become "bilingual"--it is a bit like learning to drive on the left.  The only characters that are different are ones that are used relatively infrequently in ordinary writing, such as the sterling currency symbol (£), double quote ("), and ampersat (@).  In contradistinction, the adjustment to German and French keyboard layouts is much more difficult since the positions of several letters are reversed, which makes it impossible (at least at first) to touch-type a simple text consisting only of alphanumeric characters entirely from muscle memory.  (German keyboards have a QWERTZ layout and since z is used relatively infrequently in English, they are somewhat easier for native English speakers to adjust to than French keyboards, which have an AZERTY layout.  Other European countries, such as Spain and the Netherlands, use the QWERTY layout with key reversals and substitutions which are comparatively peripheral from an English-speaking perspective.)

I am typing this post on a UK-spec keyboard, by the way, though I am American, grew up in the United States, and learned how to touch-type on a US-spec keyboard.

Quote from: kphoger on May 02, 2013, 11:43:22 AM
Am I the only who memorizes the alt codes?

ñ is alt+164
Ã' is alt+165
á is alt+160
Á is alt+0193
é is alt+130
É is alt+144
í is alt+161
Í is alt+0205
ó is alt+162

To answer your question--no.  I still remember a number of them, even for some characters which I have not had to enter using Alt codes for several years now (e.g., Alt + 156 for £).  However, I prefer not to use Alt codes if I can avoid them, for a number of reasons:

*  They are codepage-specific.  Vanilla provision for Windows computers in the US-English localization environment is either codepage 437 or 850 (which implements the three-digit Alt codes) with an overlay of codepage 1252 (ANSI for Windows) (which implements the four-digit Alt codes, most of those in ordinary usage having a leading zero).  Those codepages are not loaded on Windows computers localized for a different country-language combination, such as Japanese--for example, Alt + 156 won't produce the £ on a computer running the Japanese version of Windows.  So when my Japanese friend and I sat down to have a keyboard conversation on her computer which dealt with money amounts in the country in which we were then living (Britain), we had to write out "pounds" instead of using the sterling symbol, just to keep the talk moving along smoothly.

*  If you are writing in a context where text encoding is likely to be a factor, it frequently makes more sense to stay within the footprint of ASCII 128 than to take a chance on directly inputting a character which is then interpreted as mojibake.  When I am composing LaTeX code, for example, I have to use "\pounds{}" to produce the sterling currency symbol unless I want to mess around with the inputenc package (which is tricky to use under Windows since Notepad, which is the most convenient utility for working with text files, does not report the encoding of the currently displayed text file).

*  Just inputting the Alt code is bloody inconvenient--a minimum four keystrokes for the CP 437 combinations and five for the CP 1252 combinations, and since one key has to be held down while the others are pressed (on the numeric keypad only, don't forget--touch-typing along the top-row number keys doesn't work), both hands are taken out of use until the code is completely punched in.  For this reason I prefer to use off-the-shelf Windows keyboard layouts which offer deadkey functionality similar to what Scott5411 describes (see below).  The only Alt code I use relatively frequently when posting to this forum, for example, is Alt + 21 (CP 437) for §, nearly always for citations to the MUTCD or the Kansas Statutes Annotated.

*  Support for extended characters is uneven among the codepages.  Kphoger, a lot of the CP 1252 combinations you quoted in your original post are for characters (such as Á) which are unavailable in CP 437.  There are lots of Eastern Latin characters which are not in CP 1252, such as the dotless lowercase i (uncapitalized, unrounded i in Turkish) or the dotted uppercase I (capitalized, rounded I in Turkish).  This means I can talk correctly about Ávila and Cáceres using the combinations you quoted, but not Istanbul, Bandirma, or Diyarbakir.

*  Alt codes (and the codepages they invoke) are Windows constructs and as such are unavailable on Macs, Android OS, Linux, etc.

Quote from: Scott5114 on May 05, 2013, 02:14:47 PMOn Linux, there are no Alt codes. Instead, you can designate a key as a "Compose key" (I use right alt, but most people use one of the useless Windows keys or that strange menu key). You press it once and then type whatever symbols the desired character is composed of. So to get a euro symbol, you type Compose+C+=, to get Ã' you type Compose+N+~, to get É you type Compose+E+'.

Compose+C+C+C+P gives you ☭.

In Windows similar functionality is achieved by designating one key (usually the right-hand Alt key, which in some locales is labelled "AltGr" instead of "Alt") as the equivalent of the Compose key in your example.  Windows has long (since 98, I think) allowed you to upload custom keyboard layouts which rely on deadkey combinations to produce accented characters, but now Windows 7 has "off the shelf" keyboard layouts with this capability.  This is an important improvement since it makes the AltGr functionality accessible on shared computers where a user without administrative privileges may be able to choose a predefined keyboard layout but not to edit it or upload his or her own custom layout.

AFAIK, however, none of the Windows layouts has the CCCP Easter egg or supports Eastern Latin characters without making it unbearably difficult to work in ASCII 128.  This is why my attempts to support international characters usually stop at the eastern German and Austrian borders.  If I am in too much of a hurry to use Wikipedia redirects to grab hold of correctly accented and punctuated text that I can cut and paste into a forum post, I would rather write "Wroclaw" and take heat for not using the correctly crossed l character, than use a Western Latin-friendly German exonym like "Breslau" and have people think I am some sort of crypto-Nazi German irredentist.  It is the same with Bratislava versus Pressburg (ironically enough, the Slovak toponym is easier since it avoids the need to choose between the double s and the eszett), Kulm (properly used only for a town in North Dakota, not its namesake, the now infamous town in Poland), Grudziadz versus Graudenz, Posen versus Poznan, etc.  (This is not a problem confined to places in Europe where German exonyms have become controversial as a result of Nazi occupation and, much earlier, Bismarck's Kulturkampf and the activities of the Prussian Settlement Commission.  Izmir versus Smyrna, for example, summons the ghost of Eleftherios Venizelos and the Megali Idea.)

Anyway--returning to the topic of predefined Windows keyboard layouts--there is a US-International keyboard layout in Windows 7 which allows accented characters to be entered through AltGr and other deadkey combinations (e.g., AltGr + e for é, ` then e for è).  There is a similar layout for UK keyboards ("UK Extended") which I use for preference because I still do most of my typing on an old Logitech keyboard which has the UK physical layout and indestructible Model M-like spring-loaded keycaps, although my current laptop has a US-standard keyboard layout.  I think the UK Extended layout is better than US International because it offers access to a slightly wider range of characters, but US International is far better than the default US keyboard layout.

Windows 7 also allows the user to load multiple keyboard layouts simultaneously, switching among them as needed using Shift + Alt.  In addition to the UK Extended layout, I have the US standard layout loaded, and use it whenever I need to enter characters directly on the built-in keyboard that are not mapped to the same keys in the UK physical layout (usually the pipe and backslash since I use those characters frequently in NT batch scripts).

So, bottom line, with Windows 7 there is now absolutely no need to remember Alt codes to write the accented characters normally encountered in Spanish, French, and German, although diacritics encountered in Eastern European languages still present problems (caron, Hungarian double accent, Polish slash l, tails . . .).  I think Alt codes are still necessary for cardinal superscripts in French and Spanish, though (examples:  François Ier, 2a Ronda de Sevilla).
"It is necessary to spend a hundred lire now to save a thousand lire later."--Piero Puricelli, explaining the need for a first-class road system to Benito Mussolini

kphoger

Quote
AltGr

You know, that key would have been handy to know about when there about were seven of us trying to send emails from a cybercafe in México, and none of us could figure out how to type the @ symbol......

He Is Already Here! Let's Go, Flamingo!
Dost thou understand the graveness of the circumstances?
Deut 23:13
Male pronouns, please.

Quote from: PKDIf you can control the meaning of words, you can control the people who must use them.

vtk

#31
JN already hit the points I was going to make about CP 437 vs CP 1252, but there's one more technical clarification I'd like to make.

Unicode doesn't stop at 65535.  That's just the "basic multilingual plane".  Unicode was at one time technically infinite, but now it stops at hex 10FFFF, allowing for over 1,114,000 characters.  Note that the UTF-16 encoding uses a scheme called "surrogate pairs" to encode characters outside the BMP; as a side effect, it's impossible to encode in UTF16 the characters those surrogates would otherwise refer to. As a result, those codepoints technically don't exist in Unicode at all, even if they are possible to encode in UTF8 or other schemes.




I'm still disappointed the Unicode folks declined to allocate codepoints for Klingon.  Every fictional language/script invented by Tolkien is covered...
Wait, it's all Ohio? Always has been.

KEK Inc.

I only remembered [Alt] + 167 as º.  It varies by OS.  Old Windows didn't have some of the smaller numbers.  And then there's HTML entities...
Take the road less traveled.

vtk

Oh yeah, the C0 control code symbols (01—031) weren't implemented as of Windows 98.

And then there's often confusion between the degree symbol (° a small raised circle) and the mascuine ordinal symbol (º a small raised lowercase o) and the superscript zero (which isn't in CP1252, and I can't find in my charmap on this phone because the device's default font foesn't have that glyph).  They are not interchangeable.

PS, my phone's default sans-serif font renders π in a way which makes it recognizeable to people only familiar with the mathematical-style glyph, though it still fits in with other sans-serif characters.
Wait, it's all Ohio? Always has been.

bulldog1979

I much prefer how the Mac handles special characters: we have an Option key. To get ¢, just hold down option and type a 4 (easy to remember that ¢ is related to $.) £ is option-3 (£ and #). - is option 8 (related to the * ) and ° is option-shift-8. ¡ is option-1 (¡ vs. !). π is option-p and ∏ is option-shift-p. option-/ is ÷ and option-shift-/ is ¿.

The trickier ones are the "dead keys". option-` does nothing at first, until you press an a, e, i, o, or u second. option-` then e is è. option-e then e is é. The umlaut is option-u followed by a letter, the circumflex is option-i and the eñe is option-n then n.

Scott5114

Quote from: bulldog1979 on August 22, 2013, 07:15:36 PM
The umlaut is option-u followed by a letter, the circumflex is option-i and the eñe is option-n then n.

Interesting that they didn't go with the default X11 Compose key combinations, which are ", ^, and ~ respectively.
uncontrollable freak sardine salad chef

sammi

#36
I recently downloaded a free X11 Compose key emulator for Windows. It's called AllChars (there are probably a few more out there, but I didn't bother), and it maps the Compose key to the AltGr key (or Right Alt), so that for example ñ could be typed by pressing Compose+~+n. It comes in handy for when I feel like putting accented characters in my Filipino signs, or whenever I need to type "Montréal". :P

I also have an AutoHotKey script to type characters that AllChars doesn't support, like ₱ (the Philippine Peso sign), ಠ_ಠ (the look of disapproval) and (╯°□°)╯︵ ┻━┻ (self-explanatory).

vtk

Quote from: The Monarch
Quick, how do I take a screenshot? Shift, option... Crap! I made an umlaut!
Wait, it's all Ohio? Always has been.

sammi

Quote from: vtk on August 22, 2013, 11:41:25 PM
Quote from: The Monarch
Quick, how do I take a screenshot? Shift, option... Crap! I made an umlaut!

PrintScreen. :spin:

But for Mac, Cmd-(Control)-Shift-(3/4). Something my Apple-loving boyfriend doesn't already know.

bulldog1979

Quote from: vtk on August 22, 2013, 11:41:25 PM
Quote from: The Monarch
Quick, how do I take a screenshot? Shift, option... Crap! I made an umlaut!
command-shift-3 for the whole screen. command-shift-4 changes the cursor to a set of cross-hairs to select a part of the screen with the height and width of the selection area indicated.  command-shift-4 then space selects a specific window only; the cursor changes to a camera and the selected windows highlight in the same shaded color as selected text.

mgk920

Quote from: bulldog1979 on August 22, 2013, 07:15:36 PM
I much prefer how the Mac handles special characters: we have an Option key. To get ¢, just hold down option and type a 4 (easy to remember that ¢ is related to $.) £ is option-3 (£ and #). - is option 8 (related to the * ) and ° is option-shift-8. ¡ is option-1 (¡ vs. !). π is option-p and ∏ is option-shift-p. option-/ is ÷ and option-shift-/ is ¿.

The trickier ones are the "dead keys". option-` does nothing at first, until you press an a, e, i, o, or u second. option-` then e is è. option-e then e is é. The umlaut is option-u followed by a letter, the circumflex is option-i and the eñe is option-n then n.

I agree on the simplicity of the Mac keyboard - with the way that my brain is base-programmed, I would never be able to memorize all of those PC 'alt' codes.

Also, alt/option-e, followed any other vowel will put the Spanish accent (á, í, ó, ú) on them, too.

BTW, what is the Mac process for getting those two smiley faces that are in a post on the first page?

Mike

english si

Quote from: bulldog1979 on August 22, 2013, 07:15:36 PM£ is option-3 (£ and #)
pound and hash are related how? ;) I like my # for hash (next to enter, shift-# is ~) and shift-3 for £. Altgr-4 for € is also useful.

I did, on one computer, have word give me greek letters for use in maths/electronics equations with keyboard shortcuts so I didn't have to remember the alt-codes, but rather just type altgr-u for mu or whatever.

agentsteel53

Quote from: english si on August 23, 2013, 12:41:55 PM
pound and hash are related how? ;)

in the US, # is called "pound".  not sure why... or why both # and £ ended up above 3.
live from sunny San Diego.

http://shields.aaroads.com

jake@aaroads.com

kkt

Quote from: agentsteel53 on August 23, 2013, 12:50:02 PM
Quote from: english si on August 23, 2013, 12:41:55 PM
pound and hash are related how? ;)

in the US, # is called "pound".  not sure why... or why both # and £ ended up above 3.

It's called a pound because it's an abbreviation for pounds of weight.  Typical grocer's sign:  sungold tomatoes 3.50 /#

english si

Quote from: agentsteel53 on August 23, 2013, 12:50:02 PM
Quote from: english si on August 23, 2013, 12:41:55 PM
pound and hash are related how? ;)
in the US, # is called "pound".
knew that - hence the ;)
Quoteor why both # and £ ended up above 3.
different needs in the UK and US - we use hash more rarely. Ditto (pre internet) @ (shift-and-key-next-to-hash) and " (shift-2).
Quote from: kkt on August 23, 2013, 12:58:36 PMIt's called a pound because it's an abbreviation for pounds of weight.  Typical grocer's sign:  sungold tomatoes 3.50 /#
What's wrong with lb? Oh, that's latin and far too high class for you Americans, yet perfectly acceptable for our salt of the earth market sellers.

Our typical sign would look like this:
Sungold Tom's
£4.41/kg
£2/lb

They have to put kg, as they have to sell in kg, though they and customers deal in lbs. Many market traders now have bowls and fill them and sell them by-bowl rather than by-weight. this sign would be accompanied (in the South East) by cockney shouts of "lovely toms. two pound a pound. lovely toms".

agentsteel53

Quote from: english si on August 23, 2013, 02:40:26 PMthey have to sell in kg

why?

given that the tomatoes are right there, the customer can decide if [x tomatoes] for [y pounds] is a good deal, regardless of how they are weighed on the scale.

customer: "I'd like to purchase these tomatoes."
clerk: [puts them on the scale] "that'll be 6.49.  cash or credit?"

I could understand that a mail-order firm, or any place where you cannot inspect the merchandise before you place the order, you don't want to rack your brain trying to figure out how many nanobuicks of product you need... but at the fruit stand, why bother?
live from sunny San Diego.

http://shields.aaroads.com

jake@aaroads.com

Brandon

Quote from: english si on August 23, 2013, 02:40:26 PM
What's wrong with lb? Oh, that's latin and far too high class for you Americans, yet perfectly acceptable for our salt of the earth market sellers.

Our typical sign would look like this:
Sungold Tom's
£4.41/kg
£2/lb

They have to put kg, as they have to sell in kg, though they and customers deal in lbs. Many market traders now have bowls and fill them and sell them by-bowl rather than by-weight. this sign would be accompanied (in the South East) by cockney shouts of "lovely toms. two pound a pound. lovely toms".

Both "lb" and "#" are used in the US to denote "pound"  You never see "kg" ever in a produce section of a supermarket.  "L" is reserved almost exclusively for large pop bottles and smaller water bottles; otherwise, "oz" and "gal" are seen.  Milk is always "1/2 pt", "pt", "qt", or "gal".  Dual labeling is common, but few use the metric side of it.
"If you think this has a happy ending, you haven't been paying attention." - Ramsay Bolton, "Game of Thrones"

"Symbolic of his struggle against reality." - Reg, "Monty Python's Life of Brian"

Brandon

Quote from: agentsteel53 on August 23, 2013, 02:53:37 PM
Quote from: english si on August 23, 2013, 02:40:26 PMthey have to sell in kg

why?

It's an EU thing.  They require everything to be marked in metric even if it is for domestic consumption.

European units of measurement directives

The assholes even want to prohibit dual labeling, which, by the way, is mandated by the Federal Fair Packaging and Labeling Act in the US.
"If you think this has a happy ending, you haven't been paying attention." - Ramsay Bolton, "Game of Thrones"

"Symbolic of his struggle against reality." - Reg, "Monty Python's Life of Brian"

english si

Quote from: agentsteel53 on August 23, 2013, 02:53:37 PM
Quote from: english si on August 23, 2013, 02:40:26 PMthey have to sell in kg

why?

given that the tomatoes are right there, the customer can decide if [x tomatoes] for [y pounds] is a good deal, regardless of how they are weighed on the scale.

customer: "I'd like to purchase these tomatoes."
clerk: [puts them on the scale] "that'll be 6.49.  cash or credit?"
Credit? not at a market...

But yes, I don't really get it either. You can buy a bowl/bag of unspecified weight for a fixed amount and bowl isn't a fixed unit from stall to stall (or even from bowl to bowl).

I guess it is as metric is such a good system you have to make alternatives illegal to get people to use it (and they still don't - using the bowl/bag loophole, or having the price per pound as the round one, or making 568ml cans/bottles of beer and 568ml multiple bottles of milk with big numbers without units on it saying how many lots of 568ml it is). I'm pretty certain that the rules are petty enough to demand that if you are outrageous enough to put customary units on it, then the metric has to be first and the customary cannot be bigger (hence no units with the big numbers on milk).
Quote from: Brandon on August 23, 2013, 03:05:44 PMIt's an EU thing.  They require everything to be marked in metric even if it is for domestic consumption.

European units of measurement directives
As much as I loathe the EU, I believe it was part of the failed metrication attempt of the 60s, rather than the EU. The EU just meant that the law was enforced over-zealously and those publishing prices only in lbs, but using metric scales and a price per kg value to calculate the cost, was illegal.

Draft beer and cider isn't metric - must be sold in either 1/3 pint, 1/2 pint, 1 pint or 1/2 pint multiples. UK got an opt out clause there. There's something else IIRC, but I don't know what.

mgk920

Maybe I should just say that someone weighs (for example) £150.

:-D

Mike



Opinions expressed here on belong solely to the poster and do not represent or reflect the opinions or beliefs of AARoads, its creators and/or associates.