Unify the logic in pull_ascii_base_talloc() and pull_ucs2_base_talloc().