Ported & replaced bugged SanitizeString.