Allow specifying charset and/or improve charset detection
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Riproducete il caso HTML fornito e tracciate il percorso di rilevamento del charset utilizzato con Heuristics.ALL; l’issue non indica file sorgente né test. Definite come i chiamanti specificano un charset noto e come deve comportarsi il rilevamento di UTF-8, quindi verificate entrambi i casi con una copertura di regressione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Currently the only way to specify the charset is in the document (with BOM or <meta charset=); if the charset is known but not specified in the document, there is no way to specify it.
Additionally, charset detection even with Heuristics.ALL does not always work well; in particular, it fails to recognize UTF-8 at least if the first non-ASCII byte is late in the document. The WHATWG spec recommends that systems are able to recognize UTF-8 even if they arenʼt good at other charsets (as a non-normative note)
The UTF-8 encoding has a highly detectable bit pattern. Files from the local file system that contain bytes with values greater than 0x7F which match the UTF-8 pattern are very likely to be UTF-8, while documents with byte sequences that do not match it are very likely not. When a user agent can examine the whole file, rather than just the preamble, detecting for UTF-8 specifically can be especially effective. [PPUTF8] [UTF8DET]
(This is reproduced with multiple test documents; the smallest is below but another one output the warning method that the UTF-8 character was invalid in Windows-1252, meaning that went with the default which was a particularly bad guess)
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://fred-wang.github.io/mathml.css/mathml.css">
<title>Circle equation</title>
<!-- <meta charset="utf-8" /> -->
</head>
<body>
<p>
The equation
<math display=inline>
<mi>y</mi><mo>=</mo><mo>±</mo>
<msqrt>
<msup><mi>r</mi><mn>2</mn></msup>
<mo>-</mo>
<msup><mi>x</mi><mn>2</mn></msup>
</msqrt>
</math>
produces a circle with radius <math display=inline><mi>r</mi></math>:
</p>
<svg width="10em" height="10em" viewBox="0 0 100 100">
<desc>A circle</desc>
<circle cx="50" cy="50" r="40" fill="none" stroke="blue" stroke-width="1" />
</svg>
</body>
</html>
- Lingua principale
- Java
- Stelle
- 65
- Fork
- 29
- Merge medio
- 11g 21h
- PR unite (30g)
- 3
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di validator/htmlparser
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
validator/htmlparser#98 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
validator/htmlparser#96 · 1 commento · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
validator/htmlparser#95 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
validator/htmlparser#87 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
validator/htmlparser#60 ·
Tutte le issue di validator/htmlparser
Issue simili
-
certification
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Apertabug ecr
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Needs: Triage Type: Feature request
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
github/copilot-sdk#2760 ·