// In order to handle foreign characters, the file name is handled in metadata part instead of the InputStreamBody part.
private static MultipartEntityWithProgressListener getNewFileMultipartEntity(final String parentId, final InputStream inputStream, final String fileName)
throws BoxRestException, UnsupportedEncodingException, BoxJSONException {
MultipartEntityWithProgressListener me = new MultipartEntityWithProgressListener(HttpMultipartMode.BROWSER_COMPATIBLE);
me.addContentBodyPart(Constants.PARENT_ID, new StringBody(parentId));
me.addBoxJSONStringEntityPart(METADATA, getMetadataBody(parentId, fileName));
// The contents of the file should come after the part that specifies the parent folder id, so
// that Box's infrastructure can efficiently stream the file to its final destination based on
// the parent folder.
me.addContentBodyPart(KEY_FILE_NAME, new InputStreamBody(inputStream, PLACEHOLDER_FILENAME));