Skip to content

Commit

Permalink
'sepinf-inc#1905: always use the same fallback charset independent of OS
Browse files Browse the repository at this point in the history
  • Loading branch information
lfcnassif committed Jan 19, 2024
1 parent c4645c9 commit ebb1d04
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.Reader;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -1068,7 +1069,7 @@ public void decodeInvestiment(ResponseEnvelope re, HSSFWorkbook workbook) throws
public Charset findCharset(File file) throws IOException {
/* discover charset */
FileInputStream inputStream = new FileInputStream(file);
Charset result = Charset.defaultCharset();
Charset result = StandardCharsets.ISO_8859_1;
try {
Reader reader = new InputStreamReader(inputStream);
BufferedReader rd = new BufferedReader(reader);
Expand All @@ -1090,15 +1091,15 @@ public Charset findCharset(File file) throws IOException {
try {
return Charset.forName("windows-" + cpage);
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
} else if (matcherV2.find()) {
cpage = matcherV2.group(1);
try {
return Charset.forName(cpage);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}
Expand Down

0 comments on commit ebb1d04

Please sign in to comment.