I'm working in a project that needs to upload a file into a web application using WebClient.
I tried with the following code but the server doesn't recognize the special characters defined in the slug header and replaces them with other not printable characters.
WebClient.Headers.Clear();
WebClient.Headers.Add("Content-Type",GetMimeType(Path.GetExtension("aáñÑ.pdf")));
WebClient.Headers.Add("Accept", "*/*");
WebClient.Headers.Add("Referer", myRefererURL);
WebClient.Headers.Add("x-csrf-token", "securityTokenFromModel");
WebClient.Headers.Add("slug", "aáñÑ.pdf");
Also, after reading rfc2047 (http://www.ietf.org/rfc/rfc2047.txt) I replaced the last line with the following code, but server doesn't recognize the request and returns an error.
WebClient.Headers.Add("slug", "(=?ISO-8859-1?q?" + "aáñÑ.pdf" + "?=)");
Is there another way to set the enconding charset to allow using special characters (accents, spanish characters) in the slug header?
Edit:
After reading @Julian answer, I tried to change the slug header to look like this:
WebClient.Headers.Add("slug", "The Beach at S%C3%A8te");
But the web application sets the filename exactly: "The Beach at S%C3%A8te".
In another test, this is how Fiddler shows the request using filename "Documentación Ññ.docx":
Request made by Internet Explorer 11: OK
Request made by .NET WebClient and Google Chrome: ERROR