Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit 18224a5

Browse files
alexarchambaultsoc
authored andcommitted
Ignore UTF-8 BOM on Windows
1 parent 0ec6dad commit 18224a5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/dev/dirs/Util.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ private Util() {
2222
static final char BSD = 'b';
2323
static final char SOLARIS = 's';
2424

25+
static final String UTF8_BOM = "\ufeff";
26+
2527
static {
2628
final String os = operatingSystemName.toLowerCase(Locale.ROOT);
2729
if (os.contains("linux"))
@@ -194,6 +196,8 @@ private static String[] runCommands(int expectedResultLines, Charset charset, St
194196
try {
195197
for (int i = 0; i < expectedResultLines; i++) {
196198
String line = reader.readLine();
199+
if (i == 0 && operatingSystem == 'w' && line != null && line.startsWith(UTF8_BOM))
200+
line = line.substring(UTF8_BOM.length());
197201
results[i] = line;
198202
}
199203
return results;

0 commit comments

Comments
 (0)