per suggestion of jl, test for bad chars before starting processing