Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Maybe Computer Science should be in the College of Theology. -- R. S. Barton


devel / comp.lang.python / What do these '=?utf-8?' sequences mean in python?

SubjectAuthor
* What do these '=?utf-8?' sequences mean in python?Chris Green
+* Re: What do these '=?utf-8?' sequences mean in python?Chris Green
|+* Re: What do these '=?utf-8?' sequences mean in python?Keith Thompson
||`* Re: What do these '=?utf-8?' sequences mean in python?Chris Green
|| `* Re: What do these '=?utf-8?' sequences mean in python?jak
||  `- Re: What do these '=?utf-8?' sequences mean in python?Cameron Simpson
|`- Re: What do these '=?utf-8?' sequences mean in python?Dieter Maurer
`* Re: What do these '=?utf-8?' sequences mean in python?Peter Pearson
 `- Re: What do these '=?utf-8?' sequences mean in python?jak

1
What do these '=?utf-8?' sequences mean in python?

<gi2iij-2tau1.ln1@esprimo.zbmc.eu>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27541&group=comp.lang.python#27541

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: cl@isbd.net (Chris Green)
Newsgroups: comp.lang.python
Subject: What do these '=?utf-8?' sequences mean in python?
Date: Sat, 6 May 2023 14:50:40 +0100
Lines: 27
Message-ID: <gi2iij-2tau1.ln1@esprimo.zbmc.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 8Vll3FcXHI1Kgn/OkMm5cwJY7Pe/TA/y79HKla5R4RHikX+sA=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:ZWfZmxy8DtKCns6LfjPWKNzbv2w=
User-Agent: tin/2.6.2-20220130 ("Convalmore") (Linux/5.15.0-69-generic (x86_64))
 by: Chris Green - Sat, 6 May 2023 13:50 UTC

I'm having a real hard time trying to do anything to a string (?)
returned by mailbox.MaildirMessage.get().

I'm extracting the Subject: header from a message and, if I write what
it returns to a log file using the python logging module what I see
in the log file (when the Subject: has non-ASCII characters in it) is:-

=?utf-8?Q?aka_Marne_=C3=A0_la_Sa=C3=B4ne_(Waterways_Continental_Europe)?=

Whatever I try I am unable to change the underscore characters in the
above string back to spaces.

So, what do those =?utf-8? and ?= sequences mean? Are they part of
the string or are they wrapped around the string on output as a way to
show that it's utf-8 encoded?

If I have the string in a variable how do I replace the underscores
with spaces? Simply doing "subject.replace('_', ' ')" doesn't work,
nothing happens at all.

All I really want to do is throw the non-ASCII characters away as the
string I'm trying to match in the subject is guaranteed to be ASCII.

--
Chris Green
·

Re: What do these '=?utf-8?' sequences mean in python?

<7h6iij-nniu1.ln1@esprimo.zbmc.eu>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27544&group=comp.lang.python#27544

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: cl@isbd.net (Chris Green)
Newsgroups: comp.lang.python
Subject: Re: What do these '=?utf-8?' sequences mean in python?
Date: Sat, 6 May 2023 15:58:15 +0100
Lines: 15
Message-ID: <7h6iij-nniu1.ln1@esprimo.zbmc.eu>
References: <gi2iij-2tau1.ln1@esprimo.zbmc.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net R8Oj67Lbo21I/VspeDpwQwdWfQ/X2QfOS5z7T3Vfhyp1Yw3GY=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:S9fsO9pOTwI7jivpMlsZ+q28oWk=
User-Agent: tin/2.6.2-20220130 ("Convalmore") (Linux/5.15.0-69-generic (x86_64))
 by: Chris Green - Sat, 6 May 2023 14:58 UTC

Chris Green <cl@isbd.net> wrote:
> I'm having a real hard time trying to do anything to a string (?)
> returned by mailbox.MaildirMessage.get().
>
What a twit I am :-)

Strings are immutable, I have to do:-

newstring = oldstring.replace("_", " ")

Job done!

--
Chris Green
·

Re: What do these '=?utf-8?' sequences mean in python?

<kbn8ucFbvt3U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27545&group=comp.lang.python#27545

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: pkpearson@nowhere.invalid (Peter Pearson)
Newsgroups: comp.lang.python
Subject: Re: What do these '=?utf-8?' sequences mean in python?
Date: 6 May 2023 15:10:05 GMT
Lines: 31
Message-ID: <kbn8ucFbvt3U1@mid.individual.net>
References: <gi2iij-2tau1.ln1@esprimo.zbmc.eu>
X-Trace: individual.net EPo0YaKIB69KYyG0hkn67wQqy2o1zdC0MMN1dXOniHR/MwhNLn
Cancel-Lock: sha1:skmVObg0dt1fbQhWUQJiL0AOxik=
User-Agent: slrn/1.0.3 (Linux)
 by: Peter Pearson - Sat, 6 May 2023 15:10 UTC

On Sat, 6 May 2023 14:50:40 +0100, Chris Green <cl@isbd.net> wrote:
[snip]
> So, what do those =?utf-8? and ?= sequences mean? Are they part of
> the string or are they wrapped around the string on output as a way to
> show that it's utf-8 encoded?

Yes, "=?utf-8?" signals "MIME header encoding".

I've only blundered about briefly in this area, but I think you
need to make sure that all header values you work with have been
converted to UTF-8 before proceeding.
Here's the code that seemed to work for me:

def mime_decode_single(pair):
"""Decode a single (bytestring, charset) pair.
"""
b, charset = pair
result = b if isinstance(b, str) else b.decode(
charset if charset else "utf-8")
return result

def mime_decode(s):
"""Decode a MIME-header-encoded character string.
"""
decoded_pairs = email.header.decode_header(s)
return "".join(mime_decode_single(d) for d in decoded_pairs)

--
To email me, substitute nowhere->runbox, invalid->com.

Re: What do these '=?utf-8?' sequences mean in python?

<u35v5b$2tudn$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27551&group=comp.lang.python#27551

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nospam@please.ty (jak)
Newsgroups: comp.lang.python
Subject: Re: What do these '=?utf-8?' sequences mean in python?
Date: Sat, 6 May 2023 18:27:23 +0200
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <u35v5b$2tudn$1@dont-email.me>
References: <gi2iij-2tau1.ln1@esprimo.zbmc.eu>
<kbn8ucFbvt3U1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 6 May 2023 16:27:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9cf9e92821bd2a9dc4f849495b0e5773";
logging-data="3078583"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18akFIqkaf+8gQGynp4lMAI"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.16
Cancel-Lock: sha1:tlSj5i8ywEPQn7t/XKB3JejaxbU=
In-Reply-To: <kbn8ucFbvt3U1@mid.individual.net>
 by: jak - Sat, 6 May 2023 16:27 UTC

Peter Pearson ha scritto:
> On Sat, 6 May 2023 14:50:40 +0100, Chris Green <cl@isbd.net> wrote:
> [snip]
>> So, what do those =?utf-8? and ?= sequences mean? Are they part of
>> the string or are they wrapped around the string on output as a way to
>> show that it's utf-8 encoded?
>
> Yes, "=?utf-8?" signals "MIME header encoding".
>
> I've only blundered about briefly in this area, but I think you
> need to make sure that all header values you work with have been
> converted to UTF-8 before proceeding.
> Here's the code that seemed to work for me:
>
> def mime_decode_single(pair):
> """Decode a single (bytestring, charset) pair.
> """
> b, charset = pair
> result = b if isinstance(b, str) else b.decode(
> charset if charset else "utf-8")
> return result
>
> def mime_decode(s):
> """Decode a MIME-header-encoded character string.
> """
> decoded_pairs = email.header.decode_header(s)
> return "".join(mime_decode_single(d) for d in decoded_pairs)
>
>
>

HI,
You could also use make_header:

from email.header import decode_header, make_header

print(make_header(decode_header( subject )))

Re: What do these '=?utf-8?' sequences mean in python?

<87fs87bq4v.fsf@nosuchdomain.example.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27561&group=comp.lang.python#27561

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.python
Subject: Re: What do these '=?utf-8?' sequences mean in python?
Date: Sun, 07 May 2023 17:53:04 -0700
Organization: None to speak of
Lines: 29
Message-ID: <87fs87bq4v.fsf@nosuchdomain.example.com>
References: <gi2iij-2tau1.ln1@esprimo.zbmc.eu>
<7h6iij-nniu1.ln1@esprimo.zbmc.eu>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="4721a668038f60b2fde1557d72b01f29";
logging-data="3790914"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/xx007ivJQ7GrMbxPIUOem"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:6XFHI3p8Eh39FTNul45RYyUbTUU=
sha1:wsmFfFTYVC9v7r+ERMJY+LY+2W4=
 by: Keith Thompson - Mon, 8 May 2023 00:53 UTC

Chris Green <cl@isbd.net> writes:
> Chris Green <cl@isbd.net> wrote:
>> I'm having a real hard time trying to do anything to a string (?)
>> returned by mailbox.MaildirMessage.get().
>>
> What a twit I am :-)
>
> Strings are immutable, I have to do:-
>
> newstring = oldstring.replace("_", " ")
>
> Job done!

Not necessarily.

The subject in the original article was:
=?utf-8?Q?aka_Marne_=C3=A0_la_Sa=C3=B4ne_(Waterways_Continental_Europe)?=

That's some kind of MIME encoding. Just replacing underscores by spaces
won't necessarily give you anything meaningful. (What if there are
actual underscores in the original subject line?)

You should probably apply some kind of MIME-specific decoding. (I don't
have a specific suggestion for how to do that.)

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */

Re: What do these '=?utf-8?' sequences mean in python?

<nepmij-tdp72.ln1@esprimo.zbmc.eu>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27562&group=comp.lang.python#27562

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: cl@isbd.net (Chris Green)
Newsgroups: comp.lang.python
Subject: Re: What do these '=?utf-8?' sequences mean in python?
Date: Mon, 8 May 2023 09:45:43 +0100
Lines: 42
Message-ID: <nepmij-tdp72.ln1@esprimo.zbmc.eu>
References: <gi2iij-2tau1.ln1@esprimo.zbmc.eu> <7h6iij-nniu1.ln1@esprimo.zbmc.eu> <87fs87bq4v.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net oLHU+HDteKQtkf/eAaYS+QlRcC0kqJyuKcq65yfiM1KUHgiTA=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:tKRuC0atN4VhSRs44Cw1apLmjMo=
User-Agent: tin/2.6.2-20220130 ("Convalmore") (Linux/5.15.0-69-generic (x86_64))
 by: Chris Green - Mon, 8 May 2023 08:45 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Chris Green <cl@isbd.net> writes:
> > Chris Green <cl@isbd.net> wrote:
> >> I'm having a real hard time trying to do anything to a string (?)
> >> returned by mailbox.MaildirMessage.get().
> >>
> > What a twit I am :-)
> >
> > Strings are immutable, I have to do:-
> >
> > newstring = oldstring.replace("_", " ")
> >
> > Job done!
>
> Not necessarily.
>
> The subject in the original article was:
> =?utf-8?Q?aka_Marne_=C3=A0_la_Sa=C3=B4ne_(Waterways_Continental_Europe)?=
>
> That's some kind of MIME encoding. Just replacing underscores by spaces
> won't necessarily give you anything meaningful. (What if there are
> actual underscores in the original subject line?)
>
> You should probably apply some kind of MIME-specific decoding. (I don't
> have a specific suggestion for how to do that.)
>
Yes, OK, but my problem was that my filter looks for the string
"Waterways Continental Europe" in the message Subject: to route the
message to the appropriate mailbox. When the Subject: has accents the
string becomes "Waterways_Continental_Europe" and thus the match
fails. Simply changing all underscores back to spaces makes my test
for "Waterways Continental Europe" work. The changed Subject: line
gets thrown away after the test so I don't care about anything else
getting changed.

(When there are no accented characters in the Subject: the string is
"Waterways Continental Europe" so I can't easily change the search
text. I guess I could use an RE.)

--
Chris Green
·

Re: What do these '=?utf-8?' sequences mean in python?

<u3aiak$3rmsq$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27563&group=comp.lang.python#27563

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nospam@please.ty (jak)
Newsgroups: comp.lang.python
Subject: Re: What do these '=?utf-8?' sequences mean in python?
Date: Mon, 8 May 2023 12:19:01 +0200
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <u3aiak$3rmsq$1@dont-email.me>
References: <gi2iij-2tau1.ln1@esprimo.zbmc.eu>
<7h6iij-nniu1.ln1@esprimo.zbmc.eu> <87fs87bq4v.fsf@nosuchdomain.example.com>
<nepmij-tdp72.ln1@esprimo.zbmc.eu>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 8 May 2023 10:19:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="81dc017cfb354cfb7fa546a6dc0e3fc8";
logging-data="4053914"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+v0/gPjXORgwdc7ihFEn0O"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.16
Cancel-Lock: sha1:FGd0SP2/mF7xHnOaBi0DqB5akk0=
In-Reply-To: <nepmij-tdp72.ln1@esprimo.zbmc.eu>
 by: jak - Mon, 8 May 2023 10:19 UTC

Chris Green ha scritto:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> Chris Green <cl@isbd.net> writes:
>>> Chris Green <cl@isbd.net> wrote:
>>>> I'm having a real hard time trying to do anything to a string (?)
>>>> returned by mailbox.MaildirMessage.get().
>>>>
>>> What a twit I am :-)
>>>
>>> Strings are immutable, I have to do:-
>>>
>>> newstring = oldstring.replace("_", " ")
>>>
>>> Job done!
>>
>> Not necessarily.
>>
>> The subject in the original article was:
>> =?utf-8?Q?aka_Marne_=C3=A0_la_Sa=C3=B4ne_(Waterways_Continental_Europe)?=
>>
>> That's some kind of MIME encoding. Just replacing underscores by spaces
>> won't necessarily give you anything meaningful. (What if there are
>> actual underscores in the original subject line?)
>>
>> You should probably apply some kind of MIME-specific decoding. (I don't
>> have a specific suggestion for how to do that.)
>>
> Yes, OK, but my problem was that my filter looks for the string
> "Waterways Continental Europe" in the message Subject: to route the
> message to the appropriate mailbox. When the Subject: has accents the
> string becomes "Waterways_Continental_Europe" and thus the match
> fails. Simply changing all underscores back to spaces makes my test
> for "Waterways Continental Europe" work. The changed Subject: line
> gets thrown away after the test so I don't care about anything else
> getting changed.
>
> (When there are no accented characters in the Subject: the string is
> "Waterways Continental Europe" so I can't easily change the search
> text. I guess I could use an RE.)
>

In reality you should also take into account the fact that if the header
contains a 'b' instead of a 'q' as a penultimate character, then the
rest of the package is converted on the basis64

"=?utf-8?Q?" --> "=?utf-8?B?"

Re: What do these '=?utf-8?' sequences mean in python?

<mailman.35.1683563847.13552.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27569&group=comp.lang.python#27569

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: dieter@handshake.de (Dieter Maurer)
Newsgroups: comp.lang.python
Subject: Re: What do these '=?utf-8?' sequences mean in python?
Date: Mon, 8 May 2023 18:37:17 +0200
Lines: 12
Message-ID: <mailman.35.1683563847.13552.python-list@python.org>
References: <gi2iij-2tau1.ln1@esprimo.zbmc.eu>
<7h6iij-nniu1.ln1@esprimo.zbmc.eu>
<25689.9533.858453.692569@ixdm.fritz.box>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de kbnEVITr+Y7ezrdaLZke4AyAW54GNnYGgVhJ5vepDa4Q==
Return-Path: <dieter@handshake.de>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.042
X-Spam-Evidence: '*H*': 0.93; '*S*': 0.02; 'subject:python': 0.06;
'string': 0.07; '(?)': 0.09; ':-)': 0.09; 'cc:addr:python-list':
0.09; 'skip:` 10': 0.09; 'cc:no real name:2**0': 0.14; 'wrote:':
0.16; 'cc:addr:python.org': 0.20; 'received:de': 0.23; 'anything':
0.25; 'cc:2**0': 0.25; 'chris': 0.28; "i'm": 0.33; 'header:In-
Reply-To:1': 0.34; 'trying': 0.35; 'hard': 0.37; 'wrote': 0.39;
'subject:What': 0.40; 'skip:o 20': 0.63; 'skip:m 20': 0.63;
'header:Received:6': 0.67; 'returned': 0.81; 'received:88': 0.84;
'subject:these': 0.84; 'green': 0.96
In-Reply-To: <7h6iij-nniu1.ln1@esprimo.zbmc.eu>
X-Mailer: VM 8.0.12-devo-585 under 21.4 (patch 24) "Standard C" XEmacs Lucid
(x86_64-linux-gnu)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <25689.9533.858453.692569@ixdm.fritz.box>
X-Mailman-Original-References: <gi2iij-2tau1.ln1@esprimo.zbmc.eu>
<7h6iij-nniu1.ln1@esprimo.zbmc.eu>
 by: Dieter Maurer - Mon, 8 May 2023 16:37 UTC

Chris Green wrote at 2023-5-6 15:58 +0100:
>Chris Green <cl@isbd.net> wrote:
>> I'm having a real hard time trying to do anything to a string (?)
>> returned by mailbox.MaildirMessage.get().
>>
>What a twit I am :-)
>
>Strings are immutable, I have to do:-
>
> newstring = oldstring.replace("_", " ")

The solution based on `email.Header` proposed by `jak` is better.

Re: What do these '=?utf-8?' sequences mean in python?

<mailman.37.1683623203.13552.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27581&group=comp.lang.python#27581

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: What do these '=?utf-8?' sequences mean in python?
Date: Tue, 9 May 2023 11:38:55 +1000
Lines: 19
Message-ID: <mailman.37.1683623203.13552.python-list@python.org>
References: <u3aiak$3rmsq$1@dont-email.me> <ZFmkL9umegBnI5gP@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de 3HpVgNUwJtI6azui4SjsUQu3YwkqZUafXAsxxEjgHvUw==
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.019
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:python': 0.06;
'suggestion': 0.07; 'cheers,': 0.11; 'cameron': 0.16;
'from:addr:cs': 0.16; 'from:addr:cskk.id.au': 0.16;
'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net':
0.16; 'parsing': 0.16; 'simpson': 0.16; 'skip:> 10': 0.16;
'url:doc': 0.16; 'url:ietf': 0.16; 'wrote:': 0.16; 'instead':
0.17; 'to:addr:python-list': 0.20; 'fact': 0.28; 'header:User-
Agent:1': 0.30; 'package': 0.34; 'header:In-Reply-To:1': 0.34;
'subject:What': 0.40; 'should': 0.40; 'subject': 0.63;
'received:userid': 0.66; 'header:Received:6': 0.67; 'reach': 0.69;
'received:172.16': 0.76; '-->': 0.84; 'converted': 0.84;
'subject:these': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <u3aiak$3rmsq$1@dont-email.me>
User-Agent: Mutt/2.2.7 (2022-08-07)
X-tce-id: cskk@bigpond.com
X-tce-ares-id: ares-e{197f1798-6f3c-4e58-9bee-740a36b0a4ca}1
X-tce-spam-action: no action
X-tce-spam-score: 0.0
X-Cm-Analysis: v=2.4 cv=E4ML54Rl c=1 sm=1 tr=0 ts=645a0cf6
a=6C/qKUiz80YC8Cpr5nidlw==:117 a=6C/qKUiz80YC8Cpr5nidlw==:17
a=KUf6QCrj_GWH6wyd:21 a=kj9zAlcOel0A:10 a=P0xRbXHiH_UA:10 a=48vgC7mUAAAA:8
a=8AHkEIZyAAAA:8 a=naieqsjnRovLBBCbkeAA:9 a=CjuIK1q_8ugA:10 a=57TP5JeFGJEA:10
a=4J8S1xjGSdAA:10 a=zgiPjhLxNE0A:10 a=-c-6uHkdjtUeosrRUb1g:22
a=w1C3t2QeGrPiZgrLijVG:22
X-Cm-Envelope: MS4xfKkJq2d1zX6A2ThhyEpJ+rXx3gwiB3mauYOPdkjYSHzYeuNHMakE5cW9s8VOvFQev1Rkp7QmRXhaS2tKJYsJ51ZEVcdZ5ncF/OJm1+ia3A/FYY7dPYVN
Q7sH4EKw7SbVo7Rg5LrISRzE2QpKi3HDJLkhUly46M1I/5izzBOs6rwWHhEssq/H9i8pWyaz8hEhEw==
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <ZFmkL9umegBnI5gP@cskk.homeip.net>
X-Mailman-Original-References: <u3aiak$3rmsq$1@dont-email.me>
 by: Cameron Simpson - Tue, 9 May 2023 01:38 UTC

On 08May2023 12:19, jak <nospam@please.ty> wrote:
>In reality you should also take into account the fact that if the
>header
>contains a 'b' instead of a 'q' as a penultimate character, then the
>rest of the package is converted on the basis64
>
>"=?utf-8?Q?" --> "=?utf-8?B?"

Aye. Specification:

https://datatracker.ietf.org/doc/html/rfc2047

You should reach for jak's suggested email.header suggestion _before_
parsing the subject line. Details:

https://docs.python.org/3/library/email.header.html#module-email.header

Cheers,
Cameron Simpson <cs@cskk.id.au>


devel / comp.lang.python / What do these '=?utf-8?' sequences mean in python?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor