Issue: Tasks failing with Encoding "UTF8" has no equivalent in encoding "LATIN1"  error.


Note: 
1.Below procedure is applicable for both Trusty and Bionic Directors in 21.2.x releases
2.For Directors in HA,changes will be synced to Standby director.Please perform Step 1 and 2 ONLY on the Active director. 
3.This procedure does not involve service restart. 



Procedure to change the encoding from LATIN1 to UTF8


Step 1 : Connect to Postgres and verify the current encoding

From Shell prompt
sudo -u postgres psql


From Postgres prompt

select * from pg_database;
\l


Step 2 : Update the encoding to UT8 for the desired database and verify the change.


From Postgres prompt
update pg_database set encoding = pg_char_to_encoding('UTF8'), datcollate='en_US.UTF-8', datctype='en_US.UTF-8' where datname='vnms';

select * from pg_database;
\l


Step 3 : On both Director nodes, terminate existing connections for the new encoding take effect. (no service impact)


From Postgres prompt

select pg_terminate_backend(pid) from pg_stat_activity;

Active Director


Standby Director