Search code examples
javaandroidstringspecial-charactersandroid-file

Android: remove forbidden characters in filename


In my app, I'm creating a file. Sometimes my app crashes though, which is because the filename contains characters that are not allowed. I know I can remove those characters using String.replace(), but I don't know which characters are forbidden. So my question: which characters are forbidden or is there maybe a method I can use to remove all forbidden characters?


Solution

  • I guess this one will help you:

    It reads that all UTF-8 are allowed (by default) but that there are some reserved characters.

    With which do you have problems?