Re: broken HTML file (charset declaration *wrong*) - override possibility?? (ASSUME_CHARSET areas etc.)
Thorsten Glaser <[email protected]> Sun, 11 Jan 2026 20:35:13 +0100 (CET)
| Newsgroups | gmane.comp.web.lynx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 11 Jan 2026, Andreas Mohr via Lynx-dev wrote:
>- "outer-scope" MIME multi-part attribution is utf-8
You can ignore that.
>- the HTML document body/content is UTF-8-based
> (as can be verified via
> iconv -f utf-8 -t utf-8 <file>)
>- the document (the authoritative container scope unit) declares
> iso-8859-1 encoding for its body/content
Yes, this is a bug… in the eMail, not in lynx.
Overriding the charset is not easy, you have to edit the document
for that. (It gets even funnier if an XML PI with a charset is
present… not.)
For the case of declared latin1, contains utf-8, you could do
a rather evil thing of temporarily switching the display charset
to latin1 and “Raw 8-bit” to ON. That might just work, if you
use lynx in the C.UTF-8 locale and don’t have any nōn-ASCII UI
strings.
For your scenario of…
>- mailcap entry
> text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -collapse_br_tags -dump %s; nametemplate=andi_%s.html; copiousoutput
… you could do something like…
text/html; <%s perl -0pe 's!<meta\s+http-equiv="Content-Type"\s+content="[^"]*"\s*/?>!!ig;' | lynx -assume_charset=%{charset} -display_charset=utf-8 -collapse_br_tags -dump -stdin; nametemplate=andi_%s.html; copiousoutput
… to automatically remove such charset declaration.
gl hf,
//mirabilos
--
„Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund,
mksh auf jedem System zu installieren.“
-- XTaran auf der OpenRheinRuhr, ganz begeistert
(EN: “[…]uhr.gz is a reason to install mksh on every system.”)