Re: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread Peter J. Holzer
On 2023-05-06 16:27:04 +0200, jak wrote: > Chris Green ha scritto: > > Chris Green wrote: > > > A bit more information, msg.get("subject", "unknown") does return a > > > string, as follows:- > > > > > > Subject: > > >

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

2023-05-08 Thread Dieter Maurer
Chris Green wrote at 2023-5-6 15:58 +0100: >Chris Green 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

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

2023-05-08 Thread Keith Thompson
Chris Green writes: > Chris Green 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

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

2023-05-08 Thread jak
Peter Pearson ha scritto: On Sat, 6 May 2023 14:50:40 +0100, Chris Green 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

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

2023-05-08 Thread Peter Pearson
On Sat, 6 May 2023 14:50:40 +0100, Chris Green 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

Re: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread jak
Chris Green ha scritto: Chris Green wrote: A bit more information, msg.get("subject", "unknown") does return a string, as follows:- Subject: =?utf-8?Q?aka_Marne_=C3=A0_la_Sa=C3=B4ne_(Waterways_Continental_Europe)?= So it's the 'searchTxt in msg.get("subject", "unknown")' that's

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

2023-05-08 Thread jak
Chris Green ha scritto: Keith Thompson wrote: Chris Green writes: Chris Green 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 =

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

2023-05-08 Thread Chris Green
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

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

2023-05-08 Thread Chris Green
Keith Thompson wrote: > Chris Green writes: > > Chris Green 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 =

Re: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread Chris Green
Chris Green wrote: > A bit more information, msg.get("subject", "unknown") does return a > string, as follows:- > > Subject: > =?utf-8?Q?aka_Marne_=C3=A0_la_Sa=C3=B4ne_(Waterways_Continental_Europe)?= > > So it's the 'searchTxt in msg.get("subject", "unknown")' that's > failing. I.e. for

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

2023-05-08 Thread Chris Green
Chris Green 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: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread Chris Green
A bit more information, msg.get("subject", "unknown") does return a string, as follows:- Subject: =?utf-8?Q?aka_Marne_=C3=A0_la_Sa=C3=B4ne_(Waterways_Continental_Europe)?= So it's the 'searchTxt in msg.get("subject", "unknown")' that's failing. I.e. for some reason 'in' isn't working when

Re: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread jak
Chris Green ha scritto: I have a custom mail filter in python that uses the mailbox package to open a mail message and give me access to the headers. So I have the following code to open each mail message:- # # # Read the message from standard input and make a message object

Re: [pygettext] --package-name and --package-version unknown

2023-05-08 Thread aapost
On 5/5/23 04:39, c.bu...@posteo.jp wrote: That being said, the git repo linked earlier has accepted commits to that file earlier this year. So read in to that what you will *shrugs* -- https://mail.python.org/mailman/listinfo/python-list

Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread Chris Green
I have a custom mail filter in python that uses the mailbox package to open a mail message and give me access to the headers. So I have the following code to open each mail message:- # # # Read the message from standard input and make a message object from it # msg =

Re: [pygettext] --package-name and --package-version unknown

2023-05-08 Thread aapost
On 5/5/23 04:39, c.bu...@posteo.jp wrote: Thanks for the answer. Am 05.05.2023 03:24 schrieb aapost: pygettext is deprecated since xgettext supports python now, so using xgettext is recommended. If this is the official case then it should be mentioned in the python docs. The 3.11 docs still