code: public static String encodeToSafeAsciiFileNameString(String str, Charset strCharset) {
          if (str == null) {
              return str;
          }
          if (!SAFE_ASCII_PATTERN.matcher(str).matches()) {
              return calcSHA1Digest(str, strCharset);
          }
          // encode again since if str is SHA1 digest
          // it can easily conflict with the other encoded string
          if (SHA1_DIGEST_PATTERN.matcher(str).matches()) {
              return calcSHA1Digest(str, strCharset);
          }
          return str;
      }
docs: - character which will be encoded by URL encoding