Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Which charset is used in cronet/chromium if no explicit charset parameter in Content-type of http request

122 views
Skip to first unread message

Berte Colin

unread,
Nov 7, 2024, 2:34:52 AM11/7/24
to Chromium-dev
as title described:
Which charset is used in cronet/chromium if no explicit charset parameter in Content-type of http request 

Caleb Raitto

unread,
Nov 7, 2024, 11:14:59 AM11/7/24
to Chromium-dev, Berte Colin, net-dev
+net-dev

-Caleb

Ian Clelland

unread,
Nov 11, 2024, 9:47:41 AM11/11/24
to cara...@chromium.org, Chromium-dev, Berte Colin, net-dev
I don't think this is cronet-defined behaviour; the networking stack just gets the bytes to the rendering engine, which is responsible for interpreting them. The interpretation depends to a large extent on the content type of the resource (or the purpose of the resource, if we have to guess the content type, too). HTML resources should largely follow the spec here: https://html.spec.whatwg.org/#determining-the-character-encoding . Note, though, that this algorithm starts off deterministically, but relies heavily on heuristics and implementation-defined behaviour by the end.

Chromium's behavior for HTML documents when there are no HTTP-level signals about the encoding is mostly defined in CED, which is a separate project hosted at https://github.com/google/compact_enc_det. This gets called from DetectTextEncoding, from TextResourceDecoder:Decode, which is used in a number of places that receive bytes from the network.
XML responses, JSON responses, and other text formats all likely use a different pathway.


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/0eb382d9-8782-4825-aff1-40ac8ebfe315n%40chromium.org.
Reply all
Reply to author
Forward
0 new messages