why not base64 encode input text to produce file names: https://en.wikipedia.org/wiki/Base64#Filenames The encoded file names would be less likely to cause problem. You could get the original text input by decoding the file name.