Simplify custom UA input and escape custom UAs properly