Skip to content

Commit

Permalink
improve utf8 detction with confidence
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr committed Dec 29, 2024
1 parent 4b7ac10 commit 0714b66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/logic/importer/Importer.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ protected static Charset getCharset(BufferedInputStream bufferedInputStream) {
return defaultCharSet;
}

if (Arrays.stream(matches).anyMatch(charset -> "ASCII".equals(charset.getName()))) {
// if we have utf8 with 100 confidence we
if (Arrays.stream(matches).anyMatch(charset -> "ASCII".equals(charset.getName()) || ("UTF-8".equals(charset.getName()) && charset.getConfidence() == 100))) {
return defaultCharSet;
}

Expand Down

0 comments on commit 0714b66

Please sign in to comment.