Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ public class AutoDetectReader extends BufferedReader {
private static final EncodingDetector DEFAULT_DETECTOR;

static {
DEFAULT_DETECTOR = new CompositeEncodingDetector(
DEFAULT_LOADER.loadServiceProviders(EncodingDetector.class));
// Use DefaultEncodingDetector so SPI-discovered detectors are run in the
// pinned order (HtmlEncodingDetector, UniversalEncodingDetector, Icu4jEncodingDetector,
// then anything else by class name). Otherwise the order would be whatever
// ServiceLoader yields from classpath/jar order, which is fragile.
DEFAULT_DETECTOR = new DefaultEncodingDetector(DEFAULT_LOADER);
}

private final Charset charset;
Expand Down Expand Up @@ -79,8 +82,7 @@ private AutoDetectReader(TikaInputStream tis, Metadata metadata,

public AutoDetectReader(InputStream stream, Metadata metadata, ServiceLoader loader)
throws IOException, TikaException {
this(getTikaInputStream(stream), metadata,
new CompositeEncodingDetector(loader.loadServiceProviders(EncodingDetector.class)));
this(getTikaInputStream(stream), metadata, new DefaultEncodingDetector(loader));
}

public AutoDetectReader(InputStream stream, Metadata metadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@
<artifactId>tika-parser-digest-commons</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tika-encoding-detector-html</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tika-encoding-detector-icu4j</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tika-encoding-detector-universal</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tika-parser-font-module</artifactId>
Expand Down
Loading