Typing Danish letters without a Danish keyboard

The Danish alphabet has three more vowels than the English alphabet. And as they come in lower and upper case forms, you end up with six extra characters: æ, ø, å, Æ, Ø, Å.

Danish-KeyboardOn Danish typewriter and computer keyboards these letters are located in a little cluster to the right of the L and P keys (causing some rotation of the characters that are located there on other keyboards), and of course they’re completely absent from all keyboards bought anywhere outside of Denmark.

Fortunately the three letters have accepted substitutions: You can write “ae” instead of æ, “oe” instead of ø and “aa” instead of å, and most Danes will understand it. But it looks like crap. When you write an email or a blog comment in Danish, you’ll want to make a better impression than that.

Some programs (especially word processors) will allow you to “insert character” and let you pick the right character from a large character set. This works for entering the odd Greek letter, the symbol for degrees, etc., but it just doesn’t work for writing any length of text with more than a couple “special” vowels; and many of us do most of our writing in text editors and browsers anyway. So we need a more general solution.

AutoHotkey to the rescue

I’ve previously written an introduction to AutoHotkey as a part of the series a month of free software. This brilliant, free, cross-platform utility is excellent for handling everyday tasks like this.

I wanted an easy way to access the Danish letters on a non-Danish keyboard, i.e. a way to invoke for example “æ” through some key combination. It was obvious to use the accepted substitutions (e.g. ae=æ) but I didn’t want the mechanism to make the substitution every single time I use the two letter combinations as that would affect all my English writing as well. I needed some type of “hotkey” scheme so the substitution only happened when I explicitly asked for it.

I’ve seen many utility programs that pick a rarely used key as the trigger for special actions — for example one of the function keys at the top of the keyboard, or a combination of Alt or Ctrl and some other key, or the “`” key.

But I wanted something that was easy and fast to type. After all you want to trigger on the whole combination anyway, not on the trigger key itself, so there’s no need to use a key like a function key or “`”. Instead I use the comma (“,”). It’s easy and quick to type, and it’s usually only used in very specific ways in written English (it’s usually followed by a space or a digit).

So here are my six character substitution rules for AutoHotkey:

:?*:,ae::æ
:?*:,oe::ø
:?*:,aa::å
:?*:,AE::Æ
:?*:,OE::Ø
:?*:,AA::Å

The two hotstring modifiers have the following effects:

  • * (asterisk): An ending character (e.g. space, period, or enter) is not required to trigger the hotstring.
  • ? (question mark): The hotstring will be triggered even when it is inside another word; that is, when the character typed immediately before it is alphanumeric.

Include the six hotstring definitions in your AutoHotkey file, and now whenever you type a comma and any of the two-letter combinations, you’ll get the correct Danish letter. This works across all programs and all windows, independently of your operating system’s regional settings, etc.

And now, in German and Swedish and French and …

The "metal umlaut" was first used by Motorhead

The "metal umlaut" was first used by Motorhead

No, I haven’t written substitution rules for other languages (because I’ve never needed them). But if you need them, you can make them very easily in the same way. You can make all the various accent-letter combinations for French, you can create umlaut vowels for German and Swedish (and heavy metal band names), etc.

If this was useful, please leave a comment below. Also of course if you’ve figured an even better way to make special/regional characters accessible on non-localized hardware.

41 Comments to “Typing Danish letters without a Danish keyboard”

  1. Bonbayel 11 August 2009 at 6:35 #

    Great idea. Thanks. I have my keyboard set to toggle (in Windows) to a Danish keyboard, but I keep forgetting where all the other things have landed so I have to toggle back to English to get the ones I’ve forgotten.

    I will also make codes for é, which I enjoy having on the Danish keyboard, and the Spanish n.

  2. Jan Karlsbjerg 20 August 2009 at 12:45 #

    Ah yes, I used to do that. You can even set it up with a hotkey to quickly switch between layouts. But in order to see the current status, you have to have the language bar with the little “EN” (and “DK”, etc.) icon showing on the taskbar.

    Tangent: I can’t believe how many people have the language bar showing on their computers even though they never, ever use it. It’s just there because they never changed a default setting (set by MS Office installing, I think).

  3. James @ Left Handed Keyboard 3 October 2009 at 17:00 #

    Yeah, nice idea. On a Mac this can be a bit challenging as well.
    One way around this is you have the option to use the Danish keyboard. It takes a bit to get used to where the ‘new’ keys are, but it is very useful when you are typing more than just one or two words.

    Here are some ways To make the letters in WindowsXP:

    There are several ways to make the Danish letters in Windows. Here are some for you to choose from:

    1. Instructions for setting up WinXP so that its keyboard can toggle between English and Danish.

    1. Click on Start and go to Control Panel.
    2. Open Regional and Language Options.
    3. Click on the Languages tab
    4. Click on the Details button.
    5. Click on the Add button.
    6. Open the Input language window by clicking what’s in it.
    7. Scroll to Danish, select and click OK ONCE.

    • Jan 6 October 2009 at 17:12 #

      I used to do that (installing Windows’ built-in Danish keyboard configuration), but once you’ve got a (physical) non-DK keyboard, it gets too confusing. Too many other characters are at other locations, basically every key that’s not a letter or a number: `~!@#$%^&*()-_=+[]\{}|;<>:. In other words, all the punctuation and syntax bits that are needed in an average geek’s daily typing.

      But if somebody wants to follow that tip, note that you can also set up a keyboard combination to switch between the languages, e.g. Alt-F1 to switch to English, Alt-F2 to switch to Danish. That makes switching a lot faster and more convenient, I found.

    • Natalia 8 September 2010 at 14:26 #

      Thanks a lot!

    • Ann Balslew Moro 7 March 2013 at 12:29 #

      If I don’t have XP will this work?

  4. Sdl 2 December 2009 at 6:52 #

    Because of the script containing dansh letters, the notepad can’t save the file in ANSI format. When I chose the unicode format the script won’t run, and when i use the UTF-8 format it runs but I get wrong letters written out . When writing the ‘,aa’ for example i get Ã¥. How can I get around this problem?
    P.S. When saving scripts not containing danish letters they work OK.

  5. Jan Karlsbjerg 2 December 2009 at 21:35 #

    Brrr, I hate character set issues… not surprising for a Danish 25+ year computer techie veteran.

    I use the standard Windows 7 install (US English) and US country settings (or maybe Canadian, I don’t remember). I’m not sure what’s different in your setup.

    ae oe aa dumpAnyway, I type‘d the file from the command prompt and it looks like this.

    These are the characters in decimal:

    : ?*:,ae:: (character 230)
    : ?*:,oe:: (character 248)
    : ?*:,aa:: (character 229)
    : ?*:,AE:: (character 198)
    : ?*:,OE:: (character 216)
    : ?*:,AA:: (character 197)

  6. Sdl 3 December 2009 at 4:08 #

    You are not sure what’s the difference in my setup, but i certainly am. I don’t know the name of the setup, but what’s special about is that its Hebrew enabled: you just press alt+shift and it toggles from English to Hebrew or opposite. So when it’s not a problem in your PC it must have to do with the Hebrew. When I open the code in Danish made html documents I see Hebrew letters instead of æ, ø, å, Æ, Ø and Å. I pasted these Hebrew letters into the script document and the hotkeys now work for æ, ø and å but Æ, Ø and Å are written out as small letters in stead of capital. I don’t mind though, I’m happy having hotkeys æ, ø and å, the capitals are seldom used (except for city names: Æbeltoft, Ålborg, Århus etc.) and if you write in M. Word you can just type a point and then a letter and it changes automatically to capital.
    Thank you very much for the ideas and the help.

    • Jan 3 December 2009 at 8:53 #

      Sdl » Ahem! There’s no “Å” in “Aalborg”! Map, Wikipedia.

  7. Liz S. 7 January 2010 at 18:39 #

    I just purchased a new computer for my 79-year-old Danish mother, who lives in the USA. Being able to type easily in Danish was on her wish list. She will love this. Thanks for this info. You are a Great Dane!

  8. Michael B. Pedersen 20 January 2010 at 8:45 #

    Let me understand something right, Im a Dane, and if I get a notebook with a English keyboard i can use the ÆØÅ by switching to a Danish keyboard layout?

    • Jan 20 January 2010 at 18:34 #

      Michael B. Pedersen » Yep: Just install the Danish keyboard setting alongside the US/UK/whatever keyboard setting. When you switch language, Windows will treat your ;'[ keys as if they were æøå.

      Update: Hmm, I just read the latest post on your blog (“Ingen ASUS EEE 1201N til Danmark… og resten af Norden“) and it looks like you knew that. Did I misunderstand your comment?

  9. Morten 29 July 2010 at 12:39 #

    Hi
    I have just bought a computer in Belgium – It has an english keyboard and during setup I wrongly choose ‘danish language’. Now my keyboard is a totally mess, eg. q and a is switched and w and z. How do I change back to an english keyboard? I have Windows 7.

    Cheers Morten

    • Jan 30 July 2010 at 5:44 #

      Hi Morten

      That sounds odd: On Danish and US keyboard layouts the A-Z letters are in the same locations, so I’m not sure what has happened in your case. But here’s how to change the keyboard layout in Windows 7:

      Go to Control Panel > Region and Language > Keyboard and Languages > Change Keyboards

      Now add a new keyboard layout (and then remove the Danish layout you no longer want). It’s a nice touch that “Properties” for a keyboard layout here gives you a graphical view of the keyboard layout so you can compare against your physical keyboard.

  10. Bo 27 September 2010 at 0:57 #

    Tusind tak! Lige hvad jeg havde brug for. Have a nice one.

  11. Karsten 11 October 2010 at 13:14 #

    Fedt! For ja, det ser sku dumt ud.

  12. jamesb 29 November 2010 at 4:12 #

    For Mac users with English keyboards, you can just use these simple default shortcuts…

    æ = alt+’
    ø = alt+o
    å = alt+a

    Just add the shift key too for the uppercase. :-)

    • Jan 29 November 2010 at 12:25 #

      Sure, you can assign keyboard shortcuts like that on Windows as well. But the idea was that you just use the letter combinations that you’d be using anyway (ae, oe, aa) with the comma (or whichever other character you prefer) thrown in as an “activator”. This frees the typist from having to hit a modifier key (alt) simultaneously with a character key, and allows for faster typing.

  13. Knud Knudsen 18 March 2011 at 18:08 #

    Hi Jan, Years ago I programmed my PC (windows XP)such that
    Alt+e produced æ, Shift+Alt+e produced Æ etc for the 4 other danish vowels using a & o instead of e.
    I now have a new computer (windows 7) and I want to program it to do the same. But I can’t remember how I did it. I have the character map with all the codes but cannot figure out how to program it.

    Can you help please?
    Thank you so much, Knud Knudsen

    P.S. If you ever come to Palo Alto, CA I’d like to offer you samples of some excellent wines I have made!

    • Jan 3 April 2011 at 1:31 #

      Hi Knud, well, I don’t know what you did back then either. :-)

      But you can use AutoHotkey to achieve the same effect. Since you want to replace individual keystrokes, the codes are actually simpler than the text replacement codes in this blog post. The six keyboard redefinitions look like this (!e means Alt+e, +!e means Alt+Shift+e, etc.):

      !e::æ
      +!e::Æ
      !a::å
      +!a::Å
      !o::ø
      +!o::Ø

      Held og lykke fra Vancouver!

  14. nickgrivas 24 April 2011 at 10:23 #

    Jan, you are a gentleman and a scholar. Thanks so much for spelling this out quite simply for us who wanted a better solution. I’ll be sharing this with all my co-workers who have English keyboards and have to type Norsk regularly. Tusind tak!

  15. toto 24 October 2011 at 3:17 #

    Hi,
    Thank you for this tutorial. I am searching a method how to write dannish character and landing in your site. Thank you very much

  16. RENATA 13 November 2011 at 9:20 #

    very nice text and useful information! thanks!

  17. peter 26 February 2012 at 2:51 #

    Hey love your work. Very easy to apply etc

  18. Tookey 29 July 2012 at 1:54 #

    Hey, thanks ALOT!
    My keyboard kept typing these letters and signs after I spilled coke on my keyboard.

    f.eks, every time i typed the letter “o” the number 7 always appaired infront or after “o7″ or “7o”

    I did as you did, just removed the comma, and changed ae, aa ect to o7 and did the same with every other letter that was like this, and now my keyboard is working perfectly!

    • Jan 29 July 2012 at 14:28 #

      That is FUNNY, Tookey! It might be better to get yourself a new keyboard. They’re not very expensive, you know.

  19. khebbie 18 December 2012 at 0:36 #

    one up – top nice :-)

  20. Gandalf 29 December 2013 at 19:30 #

    I’ve been looking for a way to solve this problem on a native US keyboard layout, and this ideas from commas and autohotkey seems the best outside of changing the virtual layout dynamically with alt+shift shortcut. I’ll give it a try :)

  21. Gandalf 29 December 2013 at 19:32 #

    Jan, is it still working for you by the way or have you migraded to a different solution?

    • Jan 31 December 2013 at 0:30 #

      Prudent question, Gandalf, but yes I’m still using this now (December 2013)

  22. Gandalf 16 February 2014 at 2:30 #

    Hey Jan, did you implement a good AHK solution for accute accent as well? For the danish words idé, én, café etc.

    • Jan 1 March 2014 at 0:17 #

      Hi Gandalf

      I haven’t, because I haven’t needed it (I don’t write much in Danish). It would be very straightforward to do so. You just have to think of a typing system/syntax that would work for you, i.e. one that would be easy to remember and quick to type.

      The simplest would be
      :?*:’e::é

      That may not work for some people, for example programmers who use a lot of single quotes.

      The reverse trigger key combination
      :?*:e'::é
      wouldn’t work for most people, as it would catch for example “Joe’s” and turn it into “Joés” every time. :-)

  23. Gandalf 1 March 2014 at 3:24 #

    Ok. I’m a programmer so that probably won’t fly for me. I still use enough danish (and write english with people whose names have an accented character) that it’s an annoyance to have missing. My temporary solution is to alt+shift to change layout to danish, but it’s obviously not optimal. Will try and remember to write here when I settle on a AHK solution :)

    • Jan 1 March 2014 at 22:51 #

      If you usually use a particular program (e.g. Outlook or Word) to write in Danish and you don’t use the same program for programming, then you can make a program-specific section in your AHK file, like this:

      #IfWinActive ahk_class rctrl_renwnd32
      :?*:’e::é
      #IfWinActive ; Cancel/end the program-specific section

      You can find the Windows class name of the application by using the “Windows Spy” program that you can launch from right-clicking the AHK icon in the icon tray.

  24. Gandalf 2 March 2014 at 10:44 #

    Thanks for the suggestion, but I need it to be universally available :)

  25. Gandalf 11 August 2014 at 7:00 #

    Do you know any good AutoHotKey replacement for Linux? Maybe even multi platform?

  26. Gandalf 18 August 2014 at 23:36 #

    AutoKey: Looks good, not quite as advanced as AHK, but I don’t think I need the advanced features. However I would like something more multi-platform so I don’t have the same problem if I should change primary platform again.

    Actionaz: Linux, Windows only. Also does it do letter substitution? “Actionaz is a task automation tool. It allows you to create and execute action lists.” – doesn’t sound like it unfortunately.

    IronAHK: Multiplatform, more or less a port of AHK, this would seem great! If it wasn’t for the fact that it’s abandoned, development stopped 3 years ago, and there are no binaries / client – only source code which you have to compile yourself.

    Of the three, AutoKey seems most plausible. I’ll post an update if I do try it and get it working.

    Man I wish someone would take up IronAHK :)

  27. Soren 25 August 2014 at 5:50 #

    “My name is Jan Karlsbjerg (pronunciation guide for English speakers: [Yen Carlsberg]. I’m a techie….”

    Haha, good one!

    [...........] instead of æ, “oe” instead of ø and “aa” instead of å, and most Danes will understand it. But it looks like crap.” Hahaha, I almost die laughing at this point

    Thanks for great writing! Hope this will also solve my problem about oe, aa and so on as I am Danish, living in Thailand, and really need it.

  28. Gandalf 25 August 2014 at 13:02 #

    Soren I’ve been using Jan’s approach (,oe etc.) for some time now and it’s been great, can recommend it.


Leave a Reply