Java String Encode encodeDownloadFileName(String s)

Here you can find the source of encodeDownloadFileName(String s)

Description

encode Download File Name

License

Apache License

Declaration

public static String encodeDownloadFileName(String s) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.URLEncoder;

public class Main {
    public static String encodeDownloadFileName(String s) {
        try {// www . j ava 2 s . c  o m
            return URLEncoder.encode(s, "UTF-8").replaceAll("\\+", "%20");
        } catch (Exception e) {
            // ignore
        }
        return "";
    }
}

Related

  1. encode(String value, String encoding)
  2. encodeBase64(String str)
  3. encodeConvenience(String str)
  4. encodeDataPair(final StringBuilder buffer, final String key, final String value)
  5. encodeDoublePercent(String input)
  6. encodeFilename(final String filename, final String userAgent)
  7. encodeFilename(String filename, String encoding)
  8. encodeFilenameOmittingWhiteSpaces(String filename, String encoding)
  9. encodeForm(Map form)