UTF-8 subjects not logging correctly.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

UTF-8 subjects not logging correctly.

tejas sarade
Hello,

I have enabled subject loggin in Postfix through header_checks (/^subject:/ WARN).
and syslog_facility = mail

I have observed the encoded subject appeares in log file, sometimes.
warning: subject: =?utf-8?B?QVBMIE......

From thais I can infer that subject is in UTF-8 format.
I copied the specific mail and opened with mail client and it displayed subject in English language characters.
I checked further and there is no issue with my CentOS 5 server or the Bash shell I am using. Even the syslog also supports UTF-8 logs.
Most of the times I need to check the loges based on the subject.
Is there any way the the logged warning subject in Postfix logs can be displayed the way mail client does.


Reply | Threaded
Open this post in threaded view
|

Re: UTF-8 subjects not logging correctly.

lists@rhsoft.net


Am 19.12.2013 12:19, schrieb tejas sarade:
> I have enabled subject loggin in Postfix through header_checks (/^subject:/ WARN).
> and syslog_facility = mail
>
> I have observed the encoded subject appeares in log file, sometimes.
> warning: subject: =?utf-8?B?QVBMIE......

which is a correct encoding
http://www.rfc-editor.org/rfc/rfc2047.txt

> From thais I can infer that subject is in UTF-8 format

there is no UTF8 in the used characters
http://www.rfc-editor.org/rfc/rfc2047.txt

> I copied the specific mail and opened with mail client and it displayed subject in English language characters.
> I checked further and there is no issue with my CentOS 5 server or the Bash shell I am using. Even the syslog also
> supports UTF-8 logs

but SMTP does not support UTF8 in headers

> Most of the times I need to check the loges based on the subject.
> Is there any way the the logged warning subject in Postfix logs can be displayed the way mail client does.

hardly, postfix usually does not mangle data
Reply | Threaded
Open this post in threaded view
|

Re: UTF-8 subjects not logging correctly.

Lorens Kockum-2
In reply to this post by tejas sarade
On Thu, Dec 19, 2013 at 04:49:46PM +0530, tejas sarade wrote:
> warning: subject: =?utf-8?B?QVBMIE......
...
> Is there any way the the logged warning subject in Postfix logs can be
> displayed the way mail client does.

I suggest you run the log through a script that decodes the encoded UTF. A perl one-liner should do it:

$ cat test.log

something
warning: subject: testing four a's:=?UTF-8?B?IGHDg8Khw4PCoMODwqQ=?= end
something else

$ cat test.log | perl -MEncode=decode -ne 'print (decode("MIME-Header", "$_"))'

something
warning: subject: testing four a's: aáàä end
something else

$

Reply | Threaded
Open this post in threaded view
|

Re: UTF-8 subjects not logging correctly.

Reinaldo Gil Lima de Carvalho
In reply to this post by tejas sarade

On Thu, Dec 19, 2013 at 8:19 AM, tejas sarade <[hidden email]> wrote:
I have observed the encoded subject appeares in log file, sometimes.
warning: subject: =?utf-8?B?QVBMIE......

From thais I can infer that subject is in UTF-8 format.
I copied the specific mail and opened with mail client and it displayed subject in English language characters.
I checked further and there is no issue with my CentOS 5 server or the Bash shell I am using. Even the syslog also supports UTF-8 logs.
Most of the times I need to check the loges based on the subject.
Is there any way the the logged warning subject in Postfix logs can be displayed the way mail client does.




No. This is not about postfix or syslog systems. This is encoded / decoded by MUA. You can decode a encoded subject with any script language.

--
Reinaldo Gil Lima de Carvalho