Updated model.php with db_encoding option