I have a web-service provider(Java), which imports a .doc
file to the NotesDocument
. The problem occurs with files with Russian characters in their names - they aren't correctly transferred.
For example, if the filename
will be equal to Безымянный.doc
, it will be transferred as Áåçûìÿííûé.doc
.
File directory = new File("C:\\Attachments 1C");
String filename = "Безымянный.doc"
String path = directory + "\\" + filename;
Stream outStream = sess.createStream();
sess.setConvertMIME(true);
MIMEEntity body = newDoc.createMIMEEntity("rtBody");
Stream inStream = sess.createStream();
if (inStream.open(path, "binary")) {
if (inStream.getBytes() > 0) {
do {
byte[] buffer = inStream.read(32767);
outStream.write(buffer);
} while (!inStream.isEOS());
inStream.close();
MIMEEntity child = body.createChildEntity();
String fileSuffix = path.substring(path.lastIndexOf(".")+1);
child.setContentFromBytes(outStream, fileSuffix, MIMEEntity.ENC_IDENTITY_BINARY);
MIMEHeader header = child.createHeader("Content-Disposition");
header.setHeaderVal("attachment; filename=\"" + filename + "\"");
header = child.createHeader("Content-ID");
header.setHeaderVal(path);
outStream.truncate();
}else
return "empty file";
}else
return "couldn't open the file";
How to fix this?