Y can't Z Undo, exactly?

by Michael S. Kaplan, published on 2010/11/03 07:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2010/11/03/10085336.aspx

People sometimes ask me how many languages I speak, since I seem to talk about so many different languages all the time.

Given my incomplete knowledge of so many languages (including English!) I usually answer 0.6 languages.

But in truth between the smattering of so many languages I have learned bits and pieces of over the years, I find myself able to read a lot more mail than I ever would have thought possible.

So last night when Dimiter forwarded a mail to me accidentally, and it was entirely in Bulgarian, I took it in stride:

Subject: bug

Когато си пусне човек кирилицата на Bulgarian Phonetic (не Bulgarian Phonetic Traditional, а новата подредба дето предложиха БАН и която идваше по default с
Vista) ctrl+z спира да работи във всички програми от Notepad до Office. Много досадно. Reproduce-ва се на всички компютри 100% и не става на другите клавиатурни подредби като en, bds и phonetic traditional.

Айде ако ти пука report-вай го. Аз мисля, че достатъчно опити направих.

It took nearly four minutes before he sent another mail with the translation, apologizing for having had me on the mail (he was just looking for my email address and did not mean to have me on the reply!), I had already checked out the mail.

Actually, there were enough terms I knew and English terms (like the names of keyboard layouts on Windows) that I had already translated the mail in my head, and knew what the problem was!

Dimiter provided a confirmation that I was right, four minutes later as I mentioned:

apparently CTRL+Z doesn't work on Bulgarian (Phonetic). It doesn't repro with any other layout (including Phonetic Traditional), so it's a specific bug.

This is technically not a bug, actually.

But I should explain what is going on here.

First let's load up the Bulgarian Phonetic keyboard layout

in that tool of 1000 uses, MSKLC (Microsoft Keyboard Layout Creator):

Now of course one knows where the "Z" key is on the keyboard, it is on the key that in MSKLC is just above the Left Alt key (the one just to the right of it is the "102" key not present on some keyboards).

You know, this key:

Though if you hover over that key, you will see that the key is not what you think it is!

Try it!


What's that doing way over there?

Thank goodness for a hidden feature in MSKLC that will make finding VK_Z much easier.

Just hit the "Z" key on your keyboard and MSKLC will select the key, which turns out to be this one:

The one under the 6.

Hover over to confirm:

Wow, weird.

So, the "Y" and "Z" seem reversed.

Where have I seen that before?

Oh yeah, I remember.

On the German keyboard layout:

Whoever put together the Bulgarian Phonetic keyboard layout must have started from the German keyboard layout to get its slightly different view of the mapping between scan codes and virtual keys.

This kinda of takes us full circle to Raymond Chen's Why are the keyboard scan codes for digits off by one? (which was in turn as riff off my Off by one what, exactly?):

Of course, if the original keyboard designers had started counting from the lower left corner, like all right-thinking mathematically-inclined people, then this sort-of-coincidence would never have happened. The scan codes for the digits would have been 2E through 37, and nobody would have thought anything of it.

Further to this point about if we had gotten a different design of these key assignments, had the Virtual Key values not been based on the letters in the US keyboard, then languages that used the same Latin Script letters (e.g. French and Spanish and Portuguese and German) would not have felt compelled to move the VK values around when letters moved around. This movement is something that keyboards that use other scripts generally leave in the basic US keyboard positions and do not get in the habit of doing, so the only people who run into problems are:

Obviously a program could figure out the exact letter on the key and tell you what is for these cases, but almost no programs do.

And we can't change the layout now that it has shipped this way. The only way it could ever be "fixed" is to deprecate the old layout and add yet another Bulgarian layout -- one with identical behavior in the letters it types for most users since the keyboard shortcuts apparently are not that commonly used in Bulgarian (which is why Microsoft had never heard this bug report previously despite the keyboard layout having existed since Vista was in beta, and called Longhorn).

If I still owned MSKLC (or if the current owners ever planned to ship a version again, a concept that seems less and less likely all the time!) then I'd also suggest detecting this as a validation issue for all non-Latin script keyboard layouts (and perhaps a separate rule for Latin script lanhguage keyboards to match the VK values for roughly the same reason). But that is just something I think about in idle moments.

This kind of issue with the keyboard layout itself may well just be a permanent small confusion for the Bulgarian Phonetic keyboard layout, with just this blog (and perhaps a future KB article?) describing the full story....

Michael S. Kaplan on 4 Nov 2010 8:35 AM:

And now there is a Bulgarian pointer to this blog, here. Thanks, Doncho! :-)

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2011/01/07 Had I known that my last release would be *the* last release..., aka hindsight is 2020

go to newer or older post, or back to index or month or day