add explicit encoding option to  helper function