Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug]: WebKit decodes HTML from route.fulfill() as windows-1252, ignoring charset=utf-8

Aperta
#43,649 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

Start by tracing how WebKit handles responses created by route.fulfill() and how it sets response headers and encodes the body; compare that path with the real HTTP response behavior described here. The payload does not name source files or tests, so locate the relevant WebKit route fulfillment code and its tests. Done when the fulfilled HTML reports UTF-8 and preserves ₹, matching Chromium, Firefox, and WebKit's real server response.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs-triage-win
Version

1.64.1 (also 1.58.2 and 1.65.0-alpha-2026-10-26)

Steps to reproduce

In an empty directory on Ubuntu 24.04, run:

npm init -y
npm install [email protected]
npx playwright-core install --with-deps webkit

Save the following as repro.mjs (UTF-8), then run node repro.mjs:

import { webkit } from "playwright-core";

const browser = await webkit.launch();
const page = await browser.newPage();
await page.route("http://fulfill.test/**", (route) =>
  route.fulfill({ contentType: "text/html; charset=utf-8", body: "<!doctype html><p>₹</p>" }),
);
await page.goto("http://fulfill.test/");
console.log(await page.evaluate(() => [document.characterSet, document.querySelector("p").textContent]));
await browser.close();
Expected behavior

[ 'UTF-8', '₹' ], as in Chromium and Firefox, and as WebKit gives when a real HTTP server sends the same Content-Type: text/html; charset=utf-8 header.

Actual behavior

[ 'windows-1252', '₹' ]. It's the same with headers: { "Content-Type": "text/html; charset=utf-8" } instead of contentType, with a Buffer body, and with text/html;charset=UTF-8.

Response Chromium 156 Firefox 157 WebKit 27.2
route.fulfill({ contentType, body: string }) UTF-8 ₹ UTF-8 ₹ windows-1252 ₹
route.fulfill({ headers, body: string }) UTF-8 ₹ UTF-8 ₹ windows-1252 ₹
route.fulfill({ contentType, body: Buffer }) UTF-8 ₹ UTF-8 ₹ windows-1252 ₹
route.fulfill({ status: 200, headers: { "content-type": "text/html;charset=UTF-8" }, body: Buffer }) UTF-8 ₹ UTF-8 ₹ windows-1252 ₹
Real HTTP server, same header UTF-8 ₹ UTF-8 ₹ UTF-8 ₹
Additional context

We hit this in a test whose fulfilled page embeds a srcdoc iframe containing an inline script with non-ASCII text, allowed by a CSP sha256- hash. Incorrect decoding of the outer page changed the iframe's script text, so its hash no longer matched and WebKit refused to run it. Adding <meta charset="utf-8"> to the fulfilled page works around it.

Environment
System:
    OS: Linux 7.2 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
    CPU: (16) x64 AMD Ryzen 9 8945HS w/ Radeon 780M Graphics
    Memory: 5.44 GB / 14.91 GB
    Container: Yes
  Binaries:
    Node: 24.19.0 - /opt/acttoolcache/node/24.19.0/x64/bin/node
    npm: 11.17.0 - /opt/acttoolcache/node/24.19.0/x64/bin/npm
  Languages:
    Bash: 5.2.21 - /usr/bin/bash
  npmPackages:
    playwright-core: ^1.64.1 => 1.64.1
Lingua principale
TypeScript
Stelle
98.5k
Fork
6.7k
Merge medio
16h 5m
PR unite (30g)
286

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/playwright

Tutte le issue di microsoft/playwright

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.