added an option to encode the whole table at once and not column by column