Skip to content

Commit

Permalink
fix in detectCharset
Browse files Browse the repository at this point in the history
  • Loading branch information
CubBossa committed Dec 5, 2023
1 parent 6e2ff18 commit c6a979b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Locale;

public abstract class FileStorage {
Expand Down Expand Up @@ -70,12 +71,11 @@ public Charset detectCharset(File f, Charset[] charsets) {
return result;
}
}
return null;
return StandardCharsets.UTF_8;
}

private Charset detectCharset(File f, Charset charset) {
try {
BufferedInputStream input = new BufferedInputStream(new FileInputStream(f));
try (BufferedInputStream input = new BufferedInputStream(new FileInputStream(f))){

CharsetDecoder decoder = charset.newDecoder();
decoder.reset();
Expand Down

0 comments on commit c6a979b

Please sign in to comment.