Quantcast
Channel: Active questions tagged charset - Stack Overflow
Viewing all articles
Browse latest Browse all 64

Copy Excel file xslx encoding problems

$
0
0

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:

Compare between source (right) and copy (left)

Can anybody tell me where those come from and how I can get my correct file content?


Viewing all articles
Browse latest Browse all 64

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>