*/
public static String getFirstLine(File file) throws IOException {
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
- return reader.readLine();
+ String line = reader.readLine();
+ line = line.replace("\uFEFF", ""); // Remove BOM if present
+ return line;
}
}
*/
public static boolean fileHasToComputeMarker(File file) throws IOException {
String firstLine = getFirstLine(file);
+ firstLine = firstLine.replace("\uFEFF", ""); // Remove BOM if present
return firstLine != null && firstLine.startsWith("TOCOMPUTE:");
}
* @return a map of settings derived from that line.
*/
private Map<String, String> parseSettings(String toComputeLine) {
+ toComputeLine = toComputeLine.replace("\uFEFF", ""); // Remove BOM if present
if (!toComputeLine.startsWith("TOCOMPUTE:")) {
throw new IllegalArgumentException("Invalid TOCOMPUTE line: " + toComputeLine);
}