Come risolvere perl: avviso: impostazione locale non riuscita
Oggi, sul mio server Ubuntu ho eseguito il seguente comando per riconfigurare il server MariaDB.
sudo dpkg-reconfigure mariadb-server-10.0
Sullo schermo è apparso un avviso.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_HK:en",
LC_ALL = (unset),
LC_PAPER = "zh_CN.UTF-8",
LC_ADDRESS = "zh_CN.UTF-8",
LC_MONETARY = "zh_CN.UTF-8",
LC_NUMERIC = "zh_CN.UTF-8",
LC_TELEPHONE = "zh_CN.UTF-8",
LC_IDENTIFICATION = "zh_CN.UTF-8",
LC_MEASUREMENT = "zh_CN.UTF-8",
LC_TIME = "zh_CN.UTF-8",
LC_NAME = "zh_CN.UTF-8",
LANG = "en_HK.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_HK.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
Dice che l'impostazione della localizzazione non è riuscita.
La soluzione
Innanzitutto elenca le impostazioni locali correnti per l'utente.
$ locale
LANG=en_HK.UTF-8
LANGUAGE=en_HK:en
LC_CTYPE="en_HK.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="en_HK.UTF-8"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="en_HK.UTF-8"
LC_PAPER=zh_CN.UTF-8
LC_NAME=zh_CN.UTF-8
LC_ADDRESS=zh_CN.UTF-8
LC_TELEPHONE=zh_CN.UTF-8
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION=zh_CN.UTF-8
LC_ALL=
Quindi genera queste impostazioni locali una per una.
$ sudo locale-gen "en_HK.UTF-8"
Generating locales...
en_HK.UTF-8... up-to-date
Generation complete.
$ sudo locale-gen "zh_CN.UTF-8"
Generating locales...
zh_CN.UTF-8... done
Generation complete.
Infine riconfigurare le impostazioni locali.
$ sudo dpkg-reconfigure locales
Generating locales...
en_HK.UTF-8... done
en_US.UTF-8... done
zh_CN.UTF-8... up-to-date
Generation complete.
Ora il problema della localizzazione è scomparso.