# accented characters on shell



## Davide Pala (Dec 30, 2014)

Hi all, I'm new in the FreeBSD world, I've got a question: how I can set up my keyboard for the accented characters? I've used the standard IT keyboard layout but when use the "è" key the character printed on the shell is /350 instead of "è".

Can anyone help me? Thanks.


----------



## SirDice (Dec 30, 2014)

Please review the handbook: Chapter 23. Localization - i18n/L10n Usage and Setup


----------



## Carpetsmoker (Dec 30, 2014)

Davide Pala said:


> I've used the standard IT keyboard layout but when use the "è" key the character printed on the shell is /350 instead of "è".



Then you don't use a standard (US or US-intl) keyboard, since a standard keyboard doesn't have an è key 

In any case, setting the locale to UTF-8 is usually enough to solve the problem; this can be done with by setting the environment variable LC_ALL (with setenv or export, depending on your shell) to en_US.UTF-8 in your shell startup file.


----------



## Davide Pala (Dec 31, 2014)

Thank you Carpetsmoker. I've set LC_ALL in my /etc/login.conf file. Now this is the output of `locale -a` command:


```
LANG=it_IT.UTF-8
LC_CTYPE="it_IT.UTF-8"
LC_COLLATE="it_IT.UTF-8"
LC_TIME="it_IT.UTF-8"
LC_NUMERIC="it_IT.UTF-8"
LC_MONETARY="it_IT.UTF-8"
LC_MESSAGES="it_IT.UTF-8"
LC_ALL=
```

The situation is the same, when I press "è" key I've /350 on the console.


----------



## Juanitou (Dec 31, 2014)

I never modify /etc/login.conf, I use ~/.login_conf, for example:

```
me:\
 :charset=ISO8859-1:\  # or iso-8859-1
 :lang=fr_FR.ISO8859-1:
```


----------



## Davide Pala (Dec 31, 2014)

Juanitou if I understand correctly the file you specify is valid for a single user, I want to make the change valid for all users (existing and new)


----------



## Juanitou (Dec 31, 2014)

That’s what I also understand, but never tried it. Have you followed the instructions on top of /etc/login.conf to rebuild the database? `# cap_mkdb /etc/login.conf`


----------



## Juanitou (Dec 31, 2014)

I have also found this old comment in my notes, not sure what is worth: _UTF-8 (default for root as defined in login.conf) does not work to type special chars._


----------



## kpa (Dec 31, 2014)

The default console in FreeBSD known as the sc(4) console has rather poor support for both 8-bit character sets and Unicode (doesn't support at all in fact). The newer vt(4) console should support Unicode when used with a UTF-8 locale but you need to first figure out if the font used actually has the needed characters or if you have to load a special font that has those characters.

More information here:

https://wiki.freebsd.org/Newcons


----------



## Juanitou (Dec 31, 2014)

Juanitou said:


> I have also found this old comment in my notes, not sure what is worth: _UTF-8 (default for root as defined in login.conf) does not work to type special chars._


I can confirm it. These two lines added to the default:\ section of /etc/login.conf do not allow typing special characters, it even blocks the keyboard for some seconds:

```
:charset=UTF-8:\
:lang=it_IT.UTF-8:
```
While these work:

```
:charset=ISO8859-1:\
:lang=it_IT.ISO8859-1:
```


----------



## chrbr (Dec 31, 2014)

Dear Davide Pala,
things regarding localization are rather confusing. Now I use 
	
	



```
:charset=UTF-8:\
  :lang=de_DE.UTF-8:\
```
 in my /etc/login.conf because of the Umlaute. If you do not use UTF-8 you might face problems in communication with the outer world using text based programs as mail/mutt or news/slrn in case mails or messages are UTF-8 encoded.

Therefore I recommend to test the UTF-8 configuration with the software you intent to use. If this is not acceptable it is possible to fake an environment by using x11/luit. But I think this rather a workarround if there is any other option.


----------



## patpro (Jan 2, 2015)

Juanitou said:


> I can confirm it. These two lines added to the default:\ section of /etc/login.conf do not allow typing special characters, it even blocks the keyboard for some seconds:



That's strange. I run FreeBSD 9.3-RELEASE, and I use quite similar lines in ~/.login_conf. It's working great:


```
$ grep -v ^# ~/.login_conf 
me:\
    :charset=UTF-8:\
    :lang=en_US.UTF-8:
```

But I'm not using console directly, I've made this setting to use extended ASCII characters through `ssh` connection. My terminal emulator (Apple's Terminal.app) is configured to use UTF-8 by default too.


----------



## Davide Pala (Jan 4, 2015)

I solved it by specifying the font in the /etc/rc.conf file, these are the lines I have added:

```
font8x16="iso15-8x16.fnt"
font8x14="iso15-8x14.fnt"
font8x8="iso15-8x8.fnt"
```
and in the login.conf file I've used the it_IT.iso8859-15 locale.


----------

