🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #268413

Re: Question: Do Winston's headers cause charset issues for anyone else?

#268413
From: Dave Royal
Date: Fri, 13 Mar 2026 10:02
79 lines
5009 bytes
Maria Sophia <mariasophia@comprehension.com> Wrote in message:

> Maria Sophia wrote:
>> People have complained *to me* that my responses have mojibake in them. 
>> So I'm trying to fix that problem *for them*.
> 
> Delving deeper in thought... 
> 
> Given RFC 5322 says headers must be ASCII unless MIME-encoded, others have 
> pointed out Big-5 & ISO-8859-1 sometimes gets inserted into my headers.
> 
> I don't add that. I can't add them. They're not in my dictionaries.
> So "something else" must be adding them. But what?
> 
> I never really understood character encoding, and I've said so many times.
> But I wonder if what's happening is possibly
>  1. The "From:" display name contains raw CP1252 bytes
>  2. Which are not valid UTF-8
>  3. Where, if my outgoing message declares "charset=UTF-8"
>  4. Maybe some NNTP servers might respond by trying to be helpful
>  5. One way being by slapping a different charset label on the header
>     Given... these CP1252 bytes (0xA1, 0xA7, 0xB1, 0xF1) are 
>     a. illegal in UTF-8
>     b. legal in ISO-8859-1
>     c. also legal byte patterns in Big-5
> Maybe that's where some of my responses get ISO-8859-1 or Big-5 headers?
> 
> Maybe... given UTF-8 is not ASCII, but ASCII is valid UTF-8...
>  i. Declaring UTF-8 forces some nntp servers to validate all bytes.
>  ii. But CP1252 bytes are illegal in UTF-8
>  iii. Where UTF-8 replies trigger more server 'helpfulness'
> 
> An interesting related aside is that... for 
>  I. 0xA1 is not a valid UTF-8 start byte
>  II. 0xF1 is a valid UTF-8 start byte, 
>      but only if followed by 0x80-0xBF, which it isn't
>  III. 0xA7 is illegal as a UTF-8 start byte
>  IV. 0xB1 is illegal as a UTF-8 start byte
>  V. 0xA4 is illegal as a UTF-8 start byte
>  VI. 0xF1 is a valid UTF-8 start byte, 
>      but only if followed by 0x80-0xBF, which it isn't
> 
> The RFC-correct solution would be:
>  From: =?UTF-8?Q?W=C2=A1=C3=B1=C2=A7=C2=B1=C2=A4=C3=B1=C2=AC=C3=96=C3=9F=C3=B3=C3=B2g=C3=AE=C3=AB?= <...>
> But that's ugly.
> 
> Using W¡ñ§±¤ñ¬Ößóògîë would be even more so, given 
>  VII. 0xAC is illegal as a UTF-8 start byte
>  VIII. 0xD6 is a valid start byte only if followed by continuation byte
> And so on, where the "W" in W¡ñ§±¤ñ and the "g" in Ößóògîë are the only 
> bytes in that entire (pre 1988) decorated name that is both ASCII and valid 
> UTF-8. Everything else is raw CP1252.
> 
> The UTF-8 version of the whole name would be:
>  57 C2 A1 C3 B1 C2 A7 C2 B1 C2 A4 C3 B1 C2 AC C3 96 C3 9F C3 B3 C3 B2 67 C3 AE C3 AB
> 
> But all this is only meaningful if it causes downstream issues, 
> where I think simply switching my headers to ASCII solved the 
> mojibake that Andy, Carlos and others asked me to try to fix.
> 

I wrote a newsreader a few years ago, in Python. Python had a
 module to decode headers encoded as in RFC2047; this one I
 think:
<https://docs.python.org/3/library/email.header.html>
<https://www.ietf.org/rfc/rfc2047>

I didn't bother to detect /whether/ the headers had encoded words,
 I decoded everything in case it did. (I've seen several encoded
 words in different encodings in a single header field.)

In your case it sounds like you need an encoder as well as a
 decoder. If there aren't such modules in whatever your system is
 written in, you could write one. Perhaps a sub-process written in
 Python: pass it the raw header and it returns it in unicode. And
 vice versa to encode it.

-- 
Remove numerics from my email address.
Technical Details
Message-ID: <10p0nch$308f6$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <10ot1jr$5it$1@nnrp.usenet.blueworldhosting.com> <10otoq9$1o9q7$1@dont-email.me> <10ov0da$27r9k$1@dont-email.me> <10p08al$2pb2v$1@dont-email.me> <10p0j1u$1gjfo$1@paganini.bofh.team> <10p0lau$1go2i$1@paganini.bofh.team>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Dave Royal <dave@dave123royal.com>
Newsgroups: alt.comp.os.windows-10,news.software.readers,alt.comp.software.thunderbird
Subject: Re: Question: Do Winston's headers cause charset issues for anyone
 else?
Date: Fri, 13 Mar 2026 10:02:54 +0000 (GMT)
Organization: news.eternal-september.org
Lines: 79
Message-ID: <10p0nch$308f6$1@dont-email.me>
References: <10ot1jr$5it$1@nnrp.usenet.blueworldhosting.com> <10otoq9$1o9q7$1@dont-email.me> <10ov0da$27r9k$1@dont-email.me> <10p08al$2pb2v$1@dont-email.me> <10p0j1u$1gjfo$1@paganini.bofh.team> <10p0lau$1go2i$1@paganini.bofh.team>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 13 Mar 2026 10:02:58 +0000 (UTC)
Injection-Info: dont-email.me; posting-host="2c69baa8172787273778a05fcec12bdb";
	logging-data="3154406"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19BzEejesUjUXw8DV4fVd7s"
Cancel-Lock: sha1:spVFpi8hwzF+ceekYlcRwB7TbcE=
X-Newsreader: Mod.PiaoHong.Usenet.Client:2.02.M17