Solved system-wide UTF-8

fred974

Daemon

Reaction score: 44
Messages: 1,620

Hi,

I am trying to make my new server completely UTF8 (UNICODE) and to do this I edided /etc/login.conf by adding the following 3lines in the default:\ section
Code:
default:\
             (lines omitted) \
             :lang=en_US.UTF-8:
I then ran cap_mkdb /etc/login.conf
The output of locale is the same before and after the change...

Could anyone please help me out?
How can I change FreeBSD to be UTF8 globaly?
 

protocelt

Daemon

Reaction score: 413
Messages: 1,253

Hi,

I am trying to make my new server completely UTF8 (UNICODE) and to do this I edided /etc/login.conf by adding the following 3lines in the default:\ section
Code:
default:\
             (lines omitted) \
             :lang=en_US.UTF-8:
I then ran cap_mkdb /etc/login.conf
The output of locale is the same before and after the change...

Could anyone please help me out?
How can I change FreeBSD to be UTF8 globaly?
I have the following set in /etc/login.conf:
Code:
default:\
             [...]
             :charset=UTF-8:\
             :lang=en_US.UTF-8:\
             :umask=022:
I also set LANG in my shell's startup files. It has always seemed to work for me.
 

kpa

Beastie's Twin

Reaction score: 1,826
Messages: 6,318

You're better off leaving root's environment to the "C" locale. In theory nothing in the ports(7) or build(7) subsystems would take offense at UTF-8 locales but that's not guaranteed, especially on the ports system where ports can use their own bundled custom build tools that are outside the ports quality control.
 

Juha Nurmela

Well-Known Member

Reaction score: 121
Messages: 401

Note that you have to exit out to login: and relogin to see the change. If you are on X11, exit session.

cron(8) does not seem to do the completesetusercontext(3) for peoples cronjobs. I have lang and charset in login.conf, but trying crontab with * * * * * env > doodle gives only the
basic
Code:
LOGNAME=junki
PATH=/usr/bin:/bin
PWD=/home/junki
USER=junki
HOME=/home/junki
SHELL=/bin/sh
Something to remember.

Juha
 

MarcoB

Well-Known Member

Reaction score: 114
Messages: 391

You have to edit ~/.login_conf for every user, and then cap_mkdb that file. I would leave root's settings default.
 
OP
fred974

fred974

Daemon

Reaction score: 44
Messages: 1,620

Hi protocelt
I added
Code:
default:\
             [...]
             :charset=UTF-8:\
             :lang=en_US.UTF-8:\
I then ran # cap_mkdb /etc/login.conf
The output of locale is the same before and after the change...
I rebooted the server to be sure.. I was expecting to see all the UTF-8 setting...
 

protocelt

Daemon

Reaction score: 413
Messages: 1,253

Hi protocelt
I added
Code:
default:\
             [...]
             :charset=UTF-8:\
             :lang=en_US.UTF-8:\
I then ran # cap_mkdb /etc/login.conf
The output of locale is the same before and after the change...
I rebooted the server to be sure.. I was expecting to see all the UTF-8 setting...
Hi.

What is the output of sed -n '25,52p' /etc/login.conf on the machine?
 

MarcoB

Well-Known Member

Reaction score: 114
Messages: 391

I think the very last backslash needs to be removed.
 

Juha Nurmela

Well-Known Member

Reaction score: 121
Messages: 401

It's enough to have just ~/.login_conf in ASCII. You must either cap_mkdb it, or rm ~/.login_conf.db. Binary configs, sigh :)

Juha

Edit: off-topic, apologies, just to remind that the per-user file can be just plain text
 

protocelt

Daemon

Reaction score: 413
Messages: 1,253

It's enough to have just ~/.login_conf in ASCII. You must either cap_mkdb it, or rm ~/.login_conf.db. Binary configs, sigh :)

Juha
This works per user but not globally as fred974 specified in the topic line and first post in which case /etc/login.conf would need to be amended.

That said, I think kpa has a good point. The root account is for administrative purposes so I don't see a reason to change root's environment so this is probably the best way to change the locale. I've since changed my own configuration(s) accordingly.
 
OP
fred974

fred974

Daemon

Reaction score: 44
Messages: 1,620

Thank you all for your help.
In the end I decided to go with kpa advises and added th following in .login_conf file
Code:
me:\
        :charset=UTF-8:\
        :lang=en_US.UTF-8:\
        :setenv=LC_COLLATE=C:
 
Top