I ran into an encoding problem (I think) when I try to upload a file with a file name that has swedish charachters Ӧ Ӓ å. Applet works fine when I upload a file on Windows, but not on Mac OS.
The file name is confused when printing on the server side, which is the Domino server, and shows the fields on the Mac, but when I set the encoding to UTF-8 on new String(filename.getBytes("utf-8")), it shows ?on both Win and Win Mac.
UPDATED:
The following are snippets of code:
Setting request and publishing parameters
...
request.setParameter("Name", tmpAtt.getFileName());
...
HttpURLConnection connection ...
connection.setRequestProperty("Content-Type", "multipart/form-data; charset=UTF-8; boundary=" + boundary);
if (os == null) os = connection.getOutputStream();
Settings for File Name and Inputstream
request.setParameter(fileUploadFieldName, tmpAtt.getFilePath(), fi);
public void setParameter(String name, String filename, InputStream is) throws IOException {
boundary();
writeName(name);
write("; charset=utf-8; filename=\"");
write(filename);
write('"');
newline();
write("Content-Type:");
String type = connection.guessContentTypeFromName(filename);
if (type == null) type = "application/octet-stream";
writeln(type);
newline();
pipe(is, os);
newline();
}
At the end of the message to the server
public InputStream post() throws IOException {
boundary();
writeln("--");
printOS(os);
os.close();
InputStream iis = connection.getInputStream();
printIS(iis);
return iis;
}
Getting this output by writing bytes to an OutputStream to send a request. And the name looks good to me.
Content-Disposition: form-data; name="Name
Räpörå.log
Content-Disposition: form-data; name="Name2
Content-Disposition: form-data; name="APPROVALSTATUS
What could be the problem.
.