I am trying to copy an xslx file from a remote system within a jenkins groovy script. This xslx file is encoded with windows-1252, so I give this Charset to the FileReader and FileWriter:
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(file), Charset.forName("windows-1252"));
BufferedWriter bufferedWriter = new BufferedWriter(osw);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new SmbFileInputStream(sFile), Charset.forName("windows-1252")))) {
int byteRead;
while ((byteRead = reader.read()) != -1) {
bufferedWriter.write(byteRead);
}
bufferedWriter.flush();
}
The result xslx is encoded in windows-1252 and has nrly the same content, but there were additional questionmarks added into it:
Can anybody tell me where those come from and how I can get my correct file content?

SmbFileInputStreamtoFileOutputStream. stackoverflow.com/questions/43157/…sh "cp $sFile $file"if all you need is a copy?