Replace illegal characters with '?' placeholder.