The file we are working with has a byte order mark. Skip this and try again to read the file.

@param stream schedule data
@param length length of the byte order mark
@param charset charset indicated by byte order mark
@return ProjectFile instance
977768
private ProjectFile handleByteOrderMark(InputStream stream, int length, Charset charset) throws Exception
   {
      UniversalProjectReader reader = new UniversalProjectReader();
      reader.setSkipBytes(length);
      reader.setCharset(charset);
      return reader.read(stream);
   }
704190
public static String readString(Path targetPath, String charsetName) {
        try {
            return new String(Files.readAllBytes(targetPath),
                    Charset.forName(charsetName));
        } catch (IOException e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "readString", charsetName);
        }
    }
1337306
public static String readString(File file, Charset charset) throws IORuntimeException {
		return FileReader.create(file, charset).readString();
	}
666618
public static InputStream toStream(String content, Charset charset) {
        byte[] bytes = content.getBytes(charset);
        return new ByteArrayInputStream(bytes);
    }
108344
public static void stringToFile(String string, File file, String charsetName) {
		FileOutputStream fos = null;
		Writer writer = null;
		try {
			try {
				fos = new FileOutputStream(file);
				writer = new OutputStreamWriter(fos, charsetName);
				writer.write(string);
			} finally {
				if (writer != null) {
					writer.close();
				} else if (fos != null) {
					fos.close();
				}
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
437256
public static OutputStreamWriter getWriter(OutputStream out, String charsetName) {
		return getWriter(out, Charset.forName(charsetName));
	}
816963
public static String fileToString(File file, String charsetName) {
		FileInputStream fileInputStream = null;
		try {
			try {
				fileInputStream = new FileInputStream(file);
				return streamToString(fileInputStream, charsetName);
			} finally {
				if (fileInputStream != null) {
					fileInputStream.close();
				}
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

	}
26621
public static Optional<String> getStringAsOptWithFilePath(
            String filePath, String charsetName) {
        return JMOptional
                .getOptional(JMFiles.readString(filePath, charsetName));
    }
1177862
public String readStringFix(final int length) {
        byte[] result = new byte[length];
        byteBuf.readBytes(result);
        return new String(result);
    }
1035583
public static void toFile(Document doc, String path, String charset) {
		if (StrUtil.isBlank(charset)) {
			charset = doc.getXmlEncoding();
		}
		if (StrUtil.isBlank(charset)) {
			charset = CharsetUtil.UTF_8;
		}

		BufferedWriter writer = null;
		try {
			writer = FileUtil.getWriter(path, charset, false);
			write(doc, writer, charset, INDENT_DEFAULT);
		} finally {
			IoUtil.close(writer);
		}
	}
1211665
public static Writer getWriter(OutputStream os, Charset charset) throws IOException {
	if (charset == null) charset = SystemUtil.getCharset();
	return new BufferedWriter(new OutputStreamWriter(os, charset));
    }
68131
public static Charset getCharset(String path) {
        if (path.contains(FileUtils.FILE_PATH_CHARSET_PARAMETER)) {
            return Charset.forName(path.substring(path.indexOf(FileUtils.FILE_PATH_CHARSET_PARAMETER) + FileUtils.FILE_PATH_CHARSET_PARAMETER.length()));
        } else {
            return FileUtils.getDefaultCharset();
        }
    }
914291
public String readString(String charset) throws IOException {
		long len = readInt();

		if (len > available())
			throw new IOException("Cannot read string of length " + len
					+ " bytes when only " + available()
					+ " bytes are available");

		byte[] raw = new byte[(int) len];
		readFully(raw);
		if (encode) {
			return new String(raw, charset);
		}
		return new String(raw);

	}
743460
public static String readLine(ByteBuffer buffer, Charset charset) {
		final int startPosition = buffer.position();
		final int endPosition = lineEnd(buffer);

		if (endPosition > startPosition) {
			byte[] bs = readBytes(buffer, startPosition, endPosition);
			return StrUtil.str(bs, charset);
		} else if (endPosition == startPosition) {
			return StrUtil.EMPTY;
		}

		return null;
	}
1310665
public static BufferedReader newBufferedReader(Path path, Charset charset) throws IOException {
        return new BufferedReader(new InputStreamReader(newInputStream(path), charset));
    }
73033
public static Stream<String> getLineStream(Path path, Charset charset) {
        try {
            return charset == null ? Files.lines(path) : Files
                    .lines(path, charset);
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturn(log, e,
                    "getLineStream", Stream::empty, path, charset);
        }
    }
531586
public static ByteBuffer create(CharSequence data, Charset charset) {
		return create(StrUtil.bytes(data, charset));
	}