check database encoding code example
Example: mysql get character set
SELECT default_character_set_name FROM information_schema.SCHEMATA
WHERE schema_name = "schemaname";
SELECT default_character_set_name FROM information_schema.SCHEMATA
WHERE schema_name = "schemaname";