Added encoding detection utils.