Working with terminal in mysql with different encodings on freebsd

Hello, I'm trying to "work" with KOI-8R scripts on new FreeBSD installation, but there is one problem, the Russian characters itself looks like mess. On Linux where my production server is, before accessing mysql I'm typing some magic "source 2koi", and on locale command have such:
Code:
# locale   
LANG=ru_RU.KOI8-R
LANGUAGE=russian
LC_CTYPE="ru_RU.KOI8-R"
LC_NUMERIC="ru_RU.KOI8-R"
LC_TIME="ru_RU.KOI8-R"
LC_COLLATE="ru_RU.KOI8-R"
LC_MONETARY="ru_RU.KOI8-R"
LC_MESSAGES="ru_RU.KOI8-R"
LC_PAPER="ru_RU.KOI8-R"
LC_NAME="ru_RU.KOI8-R"
LC_ADDRESS="ru_RU.KOI8-R"
LC_TELEPHONE="ru_RU.KOI8-R"
LC_MEASUREMENT="ru_RU.KOI8-R"
LC_IDENTIFICATION="ru_RU.KOI8-R"
LC_ALL=

How can I achieve this locale goal on FreeBSD, And what is happening in the backend while wrong characters displayed?

Thanks
 
Last edited by a moderator:
The problem solved by typing "setenv LANG ru_RU.KOI8-R" in terminal, would like to understand the whole concept of interpreting data in different encodings more deeply. Thanks
 
I don't know the details but I have this for Belgium,
Code:
LANG=nl_BE.UTF-8
LANGUAGE=nl_BE.UTF-8
LC_ADDRESS=nl_BE.UTF-8
LC_ALL=nl_BE.UTF-8
LC_COLLATE=nl_BE.UTF-8
LC_CTYPE=nl_BE.UTF-8
LC_IDENTIFICATION=nl_BE.UTF-8
LC_MEASUREMENT=nl_BE.UTF-8
LC_MESSAGES=nl_BE.UTF-8
LC_MONETARY=nl_BE.UTF-8
LC_NAME=nl_BE.UTF-8
LC_NUMERIC=nl_BE.UTF-8
LC_PAPER=nl_BE.UTF-8
LC_TELEPHONE=nl_BE.UTF-8
LC_TIME=nl_BE.UTF-8
For login class for postgres(ql) i have in /etc/login.conf , lang & LC_COLLATE set.

For mysql i have in my.cnf:
Code:
character_set_server=utf8mb4
collation_server=utf8mb4_unicode_ci
 
Back
Top