当前位置:网站首页>Downloadutilse tool class without error
Downloadutilse tool class without error
2022-07-26 06:34:00 【Shandong scallion】
package cn.itcast.utils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Base64;
public class DownLoadUtils {
public static String getFileName(String agent, String filename) throws UnsupportedEncodingException {
if (agent.contains("MSIE")) {
// IE browser
filename = URLEncoder.encode(filename, "utf-8");
filename = filename.replace("+", " ");
} else if (agent.contains("Firefox")) {
// Firefox
Base64.Encoder encoder = Base64.getEncoder();
filename = "=?utf-8?B?" +encoder.encodeToString(filename.getBytes("utf-8")) + "?=";
} else {
// Other browsers
filename = URLEncoder.encode(filename, "utf-8");
}
return filename;
}
}
边栏推荐
- 力扣——4. 寻找两个正序数组的中位数
- [day_070425] legal bracket sequence judgment
- 将金额数字转换为大写
- [day_010418] delete public string
- 【C语言】通讯录动态版和文件版
- 【Day_05 0422】连续最大和
- Three skills are needed to engage in SAP related work
- 力扣5: 最长回文子串
- What are the aspects of performance testing? What are the classification and testing methods?
- [specified interval inversion in BM2 linked list]
猜你喜欢

Facing the rebound market, how do we operate? 2020-03-21

【C语言】文件操作

Input the records of 5 students (each record includes student number and grade), form a record array, and then output them in order of grade from high to low The sorting method adopts selective sortin

Flex layout

Code runner for vs code, with more than 40million downloads! Support more than 50 languages

Upgrade appium automation framework to the latest 2.0
![[pytorch] picture enlargement](/img/79/2eeefcb4623156f65957d78997e138.jpg)
[pytorch] picture enlargement

C language file operation

Overview of image classification of vision transformer must read series

Markdown add Emoji expression
随机推荐
RNN循环神经网络
Vision Transformer 必读系列之图像分类综述
Three skills are needed to engage in SAP related work
【Day_02 0419】倒置字符串
BigDecimal becomes negative
【Web3 系列开发教程——创建你的第一个 NFT(4)】NFTs 可以给你带来什么
【无标题】
将金额数字转换为大写
[day_070425] legal bracket sequence judgment
Use scanner to get multiple data types from the keyboard
【Day_03 0420】数组中出现次数超过一半的数字
[pytorch] fine tuning technology
[day_040421] calculate candy
The "darkest hour" has not come yet. Cherish every bullet 2020-03-22
Facing the rebound market, how do we operate? 2020-03-21
09 eth smart contract
[day_060423] convert string to integer
[untitled]
[1] Basic knowledge of mathematical modeling
[day02_0419] C language multiple choice questions