summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Christen <Orbiter@users.noreply.github.com>2026-01-25 19:00:33 +0100
committerGitHub <noreply@github.com>2026-01-25 19:00:33 +0100
commitebf739769169f637537a076d3c6a7567ea96c8bf (patch)
tree7607a86051cfe86aea68c57ccfd5da3e15b4aa30
parent86c45282b35f123b1fb5fdb37053dd698eb7fe40 (diff)
parent6006b19ae770cee1474e004f44ffd57b645354ef (diff)
Merge pull request #755 from Johnny1984/master
HTML5 <meta charset="..."> support
-rw-r--r--source/net/yacy/document/parser/html/ScraperInputStream.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/net/yacy/document/parser/html/ScraperInputStream.java b/source/net/yacy/document/parser/html/ScraperInputStream.java
index e722f1f93..2041aec75 100644
--- a/source/net/yacy/document/parser/html/ScraperInputStream.java
+++ b/source/net/yacy/document/parser/html/ScraperInputStream.java
@@ -109,7 +109,11 @@ public class ScraperInputStream extends InputStream implements ScraperListener {
if (tagname == null || tagname.isEmpty()) return;
if (tagname.equalsIgnoreCase("meta")) {
- if (tagopts.containsKey("http-equiv")) {
+ if (tagopts.containsKey("charset")) {
+ // parse lines like <meta charset="UTF-8">
+ this.detectedCharset = tagopts.getProperty("charset");
+ this.charsetChanged = true;
+ } else if (tagopts.containsKey("http-equiv")) {
final String value = tagopts.getProperty("http-equiv");
if (value.equalsIgnoreCase("Content-Type")) {
// parse lines like <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
@@ -117,10 +121,6 @@ public class ScraperInputStream extends InputStream implements ScraperListener {
this.detectedCharset = extractCharsetFromMimetypeHeader(contentType);
if (this.detectedCharset != null && this.detectedCharset.length() > 0) {
this.charsetChanged = true;
- } else if (tagopts.containsKey("charset")) {
- // sometimes the charset property is configured as extra attribut. try it ...
- this.detectedCharset = tagopts.getProperty("charset");
- this.charsetChanged = true;
}
}
}