replacing invalid characters