Package i2p.susi.util

Class FilenameUtil

java.lang.Object
i2p.susi.util.FilenameUtil

public class FilenameUtil
extends Object
File name encoding methods
Since:
0.9.34 pulled out of WebMail
  • Constructor Details

  • Method Details

    • sanitizeFilename

      public static String sanitizeFilename​(String name)
      Convert the UTF-8 to ASCII suitable for inclusion in a header and for use as a cross-platform filename. Replace chars likely to be illegal in filenames, and non-ASCII chars, with _ Ref: RFC 6266, RFC 5987, i2psnark Storage.ILLEGAL
      Since:
      0.9.18
    • encodeFilenameRFC5987

      public static String encodeFilenameRFC5987​(String name)
      Encode the UTF-8 suitable for inclusion in a header as a RFC 5987/6266 filename* value, and for use as a cross-platform filename. Replace chars likely to be illegal in filenames with _ Ref: RFC 6266, RFC 5987, i2psnark Storage.ILLEGAL This does NOT do multiline, e.g. filename*0* (RFC 2231) ref: https://blog.nodemailer.com/2017/01/27/the-mess-that-is-attachment-filenames/ ref: RFC 2231
      Since:
      0.9.33
    • decodeFilenameRFC5987

      public static String decodeFilenameRFC5987​(String name)
      Modified from QuotedPrintable.decode()
      Returns:
      name on error
      Since:
      0.9.34