replace invalid characters in generated file name