use scrub_rb instead of ensure_valid_encoding