如果只处理url编码,我应该使用EscapeUriString?
我将文件作为八位字节流发送到服务器,我需要在标头中指定文件名:
String filename = "«úü¡»¿.doc"
URL url = new URL("http://www.myurl.com");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.addRequestProperty("Accept", "application/json; charset=UTF-8");
conn.addRequestProperty("Content-Type", "application/octet-stream; charset=UTF-8");
conn.addRequestProperty("Filename", filename);
// do more stuff here
Run Code Online (Sandbox Code Playgroud)
问题是,我需要发送的一些文件的文件名包含非ASCII字符.我已经读过你不能在HTTP头中发送非ASCII文本.
我的问题是: