0

I'm on a second-hand macbook pro from 2013, running catalina 10.15.

It has built-in British keyboard layout but since I mostly write in Italian on an external Italian keyboard, I switched the layout to Italian from Sys preferences > Keyboard > Input sources > + > Italian.

In documents and browsers I get most of the accented vowels typical of the Italian language as well as the special characters such as pound (#), tilde (~) and the different kinds of brackets but in Terminal such characters are not represented correctly (UTF-8 encoding from Terminal's preferences, as I understand).

For example, pressing AltGr key and the à key doesn't yield # (as one would expect) in Terminal but ?. As you may understand the hash (aka pound) is essential in configuration files where it can comment out lines that are not needed. So how do I get the correct encoding/representation bw Terminal, external (lenovo) keyboard and macbook pro?

Any suggestion/workaround that I may try?


EDIT1

in Terminal '~' is apparently obtained with Alt + 5. See picture for result of this key combo: arg5 instead of tilde I get some "arg5" -- what's that now?

3
  • I should add that the characters on the keys and their counterparts with Shift are printed correctly. It's the ALTGR + key combination that doesn't print the correct character onscreen. Jan 2, 2021 at 22:59
  • What font are you using in Terminal - See Preferences->Profile->Text allows the font to be chosen
    – mmmmmm
    Jan 2, 2021 at 23:15
  • @mmmmmm tried to experiment with different fonts but problem is still there: can't correctly get '#' or '~' in Terminal, because somehow the Alt key doesn't work as expected only in Terminal (in other apps, they're correctly represented with Alt or AltGr key) Jan 3, 2021 at 10:51

3 Answers 3

2

Go to Terminal > Preferences > Keyboard and uncheck the box for Use Option as Meta Key.

1

Found a workaroud -- just installed iTerm2 from the Internet. Works alright, so far -- tilde and pound are both rendered correctly, still discovering its features.

1
  • After some more digging, turns out the culprit is the "Use Option as Meta key" checked box, in the native Terminal app's Preferences. You take that off, you get back all these characters and you can easily navigate long lines on the CLI with ALT + arrow keys. Turn it on (CMD + ALT +O), and it all goes away though you can forward delete and backward delete by words (ALT + D and ALT + Backspace, resp.ly). Read user @Touko 's response in this discussion. Jan 3, 2021 at 12:29
0

Macs don't have an AltGr key. You have to press Ctrl & Opt together to achieve the same thing… except no keyboard letter uses ctrl/opt, all available letters are under combinations of opt & shift.

On a British keyboard set to Italian, then # is on just opt à.

You can test this in the Keyboard Viewer, accessible in the language switch menu item.

1
  • @Tetsuijin tried that key combo (ALT key + 'à'). It works in Documents and browsers (as written in my OP); keeps NOT working in Terminal, and Terminal only. Clearly there's some configuration that needs to be changed, but where exactly? Tried pressing keys on the on-screen Keyboard Viewer too -- need I tell you? Terminal doesn't get them correctly. Jan 3, 2021 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .