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 ยท -- https://mail.python.org/mailman/listinfo/python-list