A few weeks ago, someone reported this to us at Medium:
“I just started an article in Polish. I can type in every letter, except Åš. When I press the key for Åš, the letter just doesn’t appear. It only happens on Medium.”
This was odd. We don’t really special-case any language in any way, and even if we did… out of 32 Polish characters, why would this random one be the only one causing problems?
Turns out, it wasn’t so random. This is a story of how four incidental ingredients spanning decades (if not centuries) came together to cause the most curious of bugs, and how we fixed it.
Interesting.
It is funny how a hack (programmer’s keyboard/klawiatura programisty) has become a de facto sole standard while the ‘official’ layout (typist’s keyboard/klawiatura maszynistki) is practically dead. I find the programmer’s keyboard superior: it is easier to get characters used in many programming languages + no need to customize hardware. There are issues, however, with software that does not differentiate between right and left Alt and/or is uneasy with sending Mod-key sequences (some VNC clients).
Edited 2015-02-03 22:09 UTC
Yeah, the US-layout is superior for programming. Try {}[] or other special characters with a Danish keyboard. Alt Gr+7 or similar. Not to mention combinations with dead keys. Or @ which requires Alt Gr+2 (far right and far left on the keyboard).
It’s even more difficult on a Mac. On a Swedish Mac keyboard I have to press alt-shift-8 to produce a ‘{‘. The worst thing is that it’s not printed on the key so people not used to Macs won’t find it. Hint: it’s the same key as ‘(‘.
As for ‘@’: it was moved with the release of the first iMac if I remember correctly. It was moved from alt-‘ (next to the return key) to alt-2 which mimics the Windows layout. The ‘2’ key is the only key to have three symbols printed on it.
I’ve seen people claim online that “real” programmers use the US layout, but so far I haven’t met any Swedish programmers who do.
I wonder how much this comes from the languages being mostly US made.
I’d probably be hard for a programming language to be successful if it isn’t based on English. Many languages these days support Unicode though, so it’s certainly possible to write variable and function names etc. in whatever language you feel like. While I haven’t seen that yet, I’ve seen plenty of code with comments written in other languages – Japanese for example.
For people wanting to explore a language not based on English there’s always APL, which comes with the added bonus of having it’s own keyboard layout.
https://en.wikipedia.org/wiki/APL_(programming_language)
Speaking a Romanian programmer, whose native tongue has accented characters:
Can we please agree to summarily execute anyone who comes up with the idea of a programming language that allows accented characters in keywords and identifiers? I’d like to be able to tell apart my identifier names on screen by a more than 2 pixel difference, thank you.
The British works perfectly too. Even though it’s quite a bit different to the US.
It might even be better, depending on what language you’re programming. In particular the easy access to # and @ as compared to the US layout can be advantageous. This only applies to PC British though, not Apple British (OS X and iOS) which don’t differ much from the US though OS X has “British PC” available. On the other hand the quotation symbol is in what, to someone used to the US layout, would seem quite an odd location if they’re not familiar with European keyboard layouts already. Doesn’t bother me, in fact I use British even though I’m from the US, because it provides a slightly closer consistency with the German and Swedish keyboard layouts which I also use.
What’s the difference? I thought you used the same layout, speaking essentially the same language – more or less?
Yeah you would think that, but no. See:
https://en.wikipedia.org/wiki/British_and_American_keyboards
for an overview. In Apple land they are essentially the same unless you set your Mac to “British PC.”
I’m not sure how to reply to that. Mind boggling is probably the word.
Well, that’s basically the English language in a nutshell anyway, so it’s fitting.
It’s not limited to English though. Canadian French has a completely different qwerty-based layout than the azerty used for Standard French. Then there’s Swiss French… Same goes for German. You have qwertz and qwerty for various countries. It’s actually a bit ridiculous when you think about it.
Personally I’m a fan of layouts optimized for typing efficiency in each language, but that really would make it a bitch to learn to type in a new language since you’d have to learn a completely new layout rather than a variation on something you most likely already know. That’s qwerty/qwertz’s advantage, it’s equally awful for everything.
That’s also the case for the Romanian language, where the programmer’s layout is the best one and at some point (Vista I believe) it was even adopted in Windows, while nobody uses the official layout with its switched Y and Z keys (is practically impossible to find such a physical keyboard)
The official Romanian keyboard standard is ASRO SR-13392:2004.
It comes with two layouts – standard and programmers.
Windows Vista included both of them and renamed the previous Microsoft layout as legacy. The legacy Microsoft layout was QWERTZ and it was hated by lots of people.
Also the Microsoft legacy layout produces the old S and T Cedilla characters (şŞţŢ) instead of the S and T Comma Below (șȘțȚ).
Coming back to ASRO SR-13392:2004, Apple decided to ignore the „programmers†layout completely. Bad Apple.
Contrary to what “nicubunu” says you can *only* buy Microsoft legacy keyboards from Dell, HP etc.
I know all of this because I tried to crowdfund a Romanian Standard keyboard and … failed.
I’ve blogged about my experience here (in Romanian) http://tastatura.info
Its kind of curious that the web page gets the key strokes before they get interpreted by what ever is responsible for drawing the glyphs.
I would assume that the right design, would be to have the glyph interpretation take place before the javascript gets access to the key strokes. So the page never sees Ctrl+S or Alt+S if the keyboard is in polish mode. It should just see the right key ( Polish-S). So from Javascript you could have a If (Polish-S) statement.
But I haven’t been involved in keyboard driver design in operating systems, so maybe there is a good reason for it happening in the order it does.
Not related to this problem in particular, but…
Anyone here who has used a Sun keyboard will know that there is a separate “compose” key for building language-specific characters.
I’m using a Sun Type 7 USB keyboard, it’s the german language variant, so “my own” special characters like ä or ß can be typed without Compose. But when I need Å or Æ or Ã¥, the Compose key is really nice. This mechanism only requires the fonts in use to display the characters properly. The ~/.xmodmap file contains “keycode 117 = Multi_key” in order to enable Compose. This key, together with the “Alt Gr” key (right Alt key), enables an additional “input level” for characters that can be typed directly with the keyboard.
I do something similar using an ordinary US-104 keyboard.
setxkbmap -variant altgr-intl -option -option lv3:ralt_switch -option compose:rctrl -option terminate:ctrl_alt_bkspc -option eurosign:e -option nbsp:level3n -option caps:hyper
It happens that Windows allows you to get Polish letters by typing tilde and than letter. So Åš can be written with ~S. It creates more problems, especially when you connect with SSH to some UNIX server. You have to type ~ twice to get one or switch to US keyboard.
Edited 2015-02-03 22:59 UTC
I enjoy articles about languages, technical issues, and history. This was very fun to read.
if S happens to be pressed with Command (metaKey, used by Macintoshes) or Ctrl (used by Windows or Linux PCs), first: prompt our editor to save what it’s doing (even though we’d autosave it soon anyway), and second: prevent anything else that would normally happen… in this case the annoying browser save dialog.
Which is the right thing to do.
What? It absolutely is not!
No website should just blindly make assumptions (such as keyboard layouts and shortcuts) and presume to deactivate key combinations. If you have the strange habit of pressing Ctrl-S every 5 seconds, the right thing to do is deactivate this shortcut in your browser! Opera (my choice) can do that out of the box, for Firefox and Chrome, there are extensions.
I hate it when software just assumes a standard keyboard layout (or even only US-qwerty) and standard shortcuts. That prevents you from changing the shortcuts to your liking. And if you use a complex keyboard layout (like me, with the whole AltGr-layer occupied and multiple dead keys), many programs choke up. Some have Ctrl-Alt-letter shortcuts, which collides with AltGr-letter on Windows*. I just manually change those, and any good software lets you do that.
* yeah, it is REALLY not necessary anymore to equate AltGr with Ctrl+Alt, for at least 20 years now. That should never have found its way into Windows NT. So this is kind of Windows’ fault. X11 is much more sane in that regard.
Edited 2015-02-04 04:42 UTC
Same here. it’s not uncommon to see Mac applications using shortcuts involving /, [ or ]. At that point I just press alt-cmd-7, 8 or 9 and hope for the best. Sometimes it works and sometimes it doesn’t. \ is an even bigger nightmare since it’s mapped to alt-shift-7*. The shortcuts are changed if the application is localised, e.g. cmd-ö and cmd-ä, but a lot of applications aren’t.
* If you run Windows in a VM on a Mac and try to enter a path all kinds of fun may happen.
There are so many odd things in this story..
First of all if they had only used US keyboard in the international layout or a UK keyboard, the diacritics can be made with dead keys (‘ key followed by s key produces Å›). See https://en.wikipedia.org/wiki/Dead_key
Second ‘right alt’, is not ‘alt’ on international keyboards, it is “Alt Gr.” because this function is how it is used in many languages. See https://en.wikipedia.org/wiki/AltGr_key
Third, they could have used a compose key.
Though blame on microsoft too. Why would the alt+ctrol hack still be around. AltGr has separate key signals now, and why would it be translated and sent like that through to user key event handling? Edit: Unless this is the keyboard doing that shit, then it is a broken old keyboard. According to https://en.wikipedia.org/wiki/AltGr_key#Control_.2B_Alt_as_a_substit… this is just a hack to allow users to access alt gr when not available on the keyboard.
Edited 2015-02-04 14:35 UTC
Same story with the Romanian letter ÃŽ, which is generated using the Romanian Pro keyboard using AltGr+I.
And instead of medium.com we have yahoo webmail.
On Windows AltGr is decomposed as Ctrl+Alt and Ctrl+I
in yahoo webmail world means setting the Italic flag.
Yey webapps!
My favorite country I’ve ever been in – Poland.
Crazy, independent, funny, interesting people, rebuilding that country for 20 years now. Lots of excitement and change going on there.
Beautiful architecture, both the cities and the villages. Great food.
Also, Very nice female talent helps!