Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置attname 出现中文乱码 #616

Open
J-TIGGER opened this issue Mar 5, 2025 · 1 comment
Open

设置attname 出现中文乱码 #616

J-TIGGER opened this issue Mar 5, 2025 · 1 comment

Comments

@J-TIGGER
Copy link

J-TIGGER commented Mar 5, 2025

设置attname 如下:
DownloadUrl url = new DownloadUrl(domain, Boolean.FALSE, fileBase.getKey());
String fileName = "学习.3.0.docx"
String attname = URLEncoder.encode(fileName, "utf-8").replace("+", "%20");
url.setAttname(attname);

使用版本如下:

com.qiniu
qiniu-java-sdk
7.18.0

问题描述:
已经设置编码格式,但是下载文件的时候仍然出现文件名乱码的行为。

@YangSen-qn
Copy link
Collaborator

下载是通过浏览器还是在 Java 工程中?
浏览器下载可能可浏览器的解析有关,文件名指定的是 utf-8 编码,但浏览器可能会按照其他编码解析就会导致乱码(比如常见的 GBK);在 Java 工程中我们对上述代码进行了验证,并未复现出乱码。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants