- 1. Correction
On the site there was one bug that manifested itself when trying to attach to files messages whose names were in Cyrillic. In this case, the site issued error 503. This occurred despite the fact that the database was encoded in UTF8, after correcting the encoding of the database itself in the previous article . While Django issued the following message:
'latin-1' codec can't encode characters in position 55-64: ordinal not in range(256)
The problem was that the server's coding was initially set to LATIN1. That is, the following commands gave the following conclusion:
postgres=# show server_encoding; server_encoding ----------------- LATIN1 (1 row) postgres=# show client_encoding; client_encoding ----------------- LATIN1 (1 row) postgres=# \encoding LATIN1
Executing the command SET CLIENT_ENCODING TO 'utf 8'; did not work, after exiting psql, the encoding was returned to LATIN1 .
Correction
Correction of this bug reduced to setting the encoding of the server itself. Since the server is primarily Russian-speaking, the installation of Russian-language packages of locales was made to correct it.
sudo apt-get install language-pack-ru
Implementation of the Russification process
sudo update-locale LANG=ru_RU.UTF-8
And reboot the server
sudo reboot
After that, the server client encoding became UTF8
postgres=# show server_encoding; server_encoding ----------------- LATIN1 (1 row) postgres=# show client_encoding; client_encoding ----------------- UTF8 (1 row) postgres=# \encoding UTF8
This was enough to fix the bug.