Resolved Terminal stopped recognising Danish keyboard

Discussion in 'Mac Programming' started by KasperOsterbye, Dec 21, 2016.

  1. KasperOsterbye macrumors newbie

    Joined:
    Dec 21, 2016
    #1
    I believe it happened after the installation of the new Command Line Tools on macOS Sierra, version 8.2.

    If I have a file with Danish characters it come out right if I cat, more or in other way lists it contents.

    However, the danish keys (æøå) do not work in terminal - æ and å are ignored, and ø produces a "(arg: 8) " prompt.

    The rest of the apps seems to work just fine. Any idea of where to start looking?

    Best,

    Kasper
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    First, there is an environment variable that can affect how command-line tools use text encodings. Post the output of this Terminal command:
    Code:
    printenv | sort

    Second, if you copy and paste the characters that have problems, rather than pressing keys for them, are the pasted characters correct?

    For example, enter this command in a Terminal window:
    Code:
    hexdump -C
    It will await your input. Then press the problematic keys and press RETURN.

    Next, paste in the problematic characters and press RETURN. You can type them in another app and copy/paste into Terminal, or you can copy from your original post and paste into Terminal.

    Then press control-D (EOF), and finally copy and paste the complete output into a post here.


    Please use CODE tags around the Terminal text you paste into posts here.
     
  3. KasperOsterbye thread starter macrumors newbie

    Joined:
    Dec 21, 2016
    #3
    Thanks chown33

    To answer your questions.

    sorted printenv gives:
    Code:
    Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.omSTbDdQUn/Render
    DISPLAY=/private/tmp/com.apple.launchd.uDTp38bz8j/org.macosforge.xquartz:0
    HOME=/Users/kasper
    LANG=en_DK.utf8
    LANGUAGE=en_DK.utf8
    LC_ALL=en_DK.utf8
    LOGNAME=kasper
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/CrossPack-AVR/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Library/TeX/texbin
    PWD=/Users/kasper
    SHELL=/bin/bash
    SHLVL=1
    SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.aw7jzKOozK/Listeners
    TERM=xterm-256color
    TERM_PROGRAM=Apple_Terminal
    TERM_PROGRAM_VERSION=388
    TERM_SESSION_ID=46496D15-1EEA-4604-BB22-169CCCAB6116
    TMPDIR=/var/folders/gt/l82_8jsd4wd8cvyqh23fcsb40000gr/T/
    USER=kasper
    XPC_FLAGS=0x0
    XPC_SERVICE_NAME=0
    _=/usr/bin/printenv
    __CF_USER_TEXT_ENCODING=0x1F8:0x0:0x0
    I was not able to type the "|" (which is alt-i on my keyboard), but I was able to paste the printenv | sort command.

    Next - the paste of the æøå characters gives me:
    Code:
    $ hexdump -C
    æøå
    00000000  c3 a6 c3 b8 c3 a5 0a                              |.......|
    00000007
    Also - I should be able to type the | symbol - however typing "|" followed by return gives:
    Code:
    $ hexdump -C
    ^[i   
    00000000  1b 69 0a                                          |.i.|
    00000003
    I got a bit curious on the __CF_USER_TEXT_ENCODING, and there is a file in my home directory with this contents:
    Code:
    $ cat .CFUserTextEncoding
    0x0:0x0$
     
  4. KasperOsterbye thread starter macrumors newbie

    Joined:
    Dec 21, 2016
    #4
    Alas - the solution in the end turned out to be combination of two things:
    • I had a .bash_profile setting the environment variables
    • I had unchecked the "set locale environment" in the advanced settings of the terminal profiles.
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    Resolved?
     

Share This Page