Wrong Encoding in SMTPAppender

Hi, I configured my SMTPAppender like this <appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <Subject>Error on - %p%nopex</Subject> <Encoding>UTF-8</Encoding> <SMTPHost>192.168.11.41</SMTPHost> <To>error@xxxxxxxx.xx</To> <From>error@xxxxxxx.xx/From> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date [%thread] %-5level %logger{50} - %msg%n%ex</pattern> </layout> </appender> The email is sent from code : log.error("Ordine " + myOrderHeader.getIdorder() + " è stato pagato ma il prodotto è già SCADUTO !! Res / Item " + myOrderHeader.getIdreseller() + " / " + itemMaster.getItemId()); And this is the mail source : ------=_Part_82_50553.1232007757067 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2009-01-15 09:22:37,067 [http--80-8] ERROR it.dnshst.useritem.UserItem - Or= dine 158 =E8 stato pagato ma il prodotto =E8 gi=E0 SCADUTO !! Res / Item 1 = / 1504 ------=_Part_82_50553.1232007757067-- And this is displaied 2009-01-15 09:22:37,067 [http--80-8] ERROR it.dnshst.useritem.UserItem - Ordine 158 � stato pagato ma il prodotto � gi� SCADUTO !! Res / Item 1 / 1504 All character "extend" are wrong encoding (è à). Any Hints ? Thanks a lot -- Alex Fustini Mysql Developer 5 Certified Mysql Dba 5 Certified

Hello Alex, I have opened an issue regarding this problem. Its URL is: http://jira.qos.ch/browse/LBCLASSIC-106 alex wrote:
Hi, I configured my SMTPAppender like this
<appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <Subject>Error on - %p%nopex</Subject> <Encoding>UTF-8</Encoding> <SMTPHost>192.168.11.41</SMTPHost> <To>error@xxxxxxxx.xx</To> <From>error@xxxxxxx.xx/From> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date [%thread] %-5level %logger{50} - %msg%n%ex</pattern> </layout> </appender>
The email is sent from code :
log.error("Ordine " + myOrderHeader.getIdorder() + " è stato pagato ma il prodotto è già SCADUTO !! Res / Item " + myOrderHeader.getIdreseller() + " / " + itemMaster.getItemId());
And this is the mail source :
------=_Part_82_50553.1232007757067 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
2009-01-15 09:22:37,067 [http--80-8] ERROR it.dnshst.useritem.UserItem - Or= dine 158 =E8 stato pagato ma il prodotto =E8 gi=E0 SCADUTO !! Res / Item 1 = / 1504
------=_Part_82_50553.1232007757067--
And this is displaied
2009-01-15 09:22:37,067 [http--80-8] ERROR it.dnshst.useritem.UserItem - Ordine 158 � stato pagato ma il prodotto � gi� SCADUTO !! Res / Item 1 / 1504
All character "extend" are wrong encoding (è à).
Any Hints ? Thanks a lot
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch

Sorry Ceki , I give you more information for debug if possible : The code run on Resin 3.1.6 using java 1.6.0.6, logback 0.9.11., slf4j ver 1.5.5 and using Thunderbird 2.0.0.19 to read Do you use a stand alone application to test it ? Is possible to have the code for test in my enviroment ? Thanks a lot for all PS Sorry I do not understand if is possible to me to continue on jiira to continue the description.. Should I register to do that ? Ceki Gulcu wrote:
Hello Alex,
I have opened an issue regarding this problem. Its URL is:
http://jira.qos.ch/browse/LBCLASSIC-106
alex wrote:
Hi, I configured my SMTPAppender like this
<appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <Subject>Error on - %p%nopex</Subject> <Encoding>UTF-8</Encoding> <SMTPHost>192.168.11.41</SMTPHost> <To>error@xxxxxxxx.xx</To> <From>error@xxxxxxx.xx/From> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date [%thread] %-5level %logger{50} - %msg%n%ex</pattern> </layout> </appender>
The email is sent from code :
log.error("Ordine " + myOrderHeader.getIdorder() + " è stato pagato ma il prodotto è già SCADUTO !! Res / Item " + myOrderHeader.getIdreseller() + " / " + itemMaster.getItemId());
And this is the mail source :
------=_Part_82_50553.1232007757067 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
2009-01-15 09:22:37,067 [http--80-8] ERROR it.dnshst.useritem.UserItem - Or= dine 158 =E8 stato pagato ma il prodotto =E8 gi=E0 SCADUTO !! Res / Item 1 = / 1504
------=_Part_82_50553.1232007757067--
And this is displaied
2009-01-15 09:22:37,067 [http--80-8] ERROR it.dnshst.useritem.UserItem - Ordine 158 � stato pagato ma il prodotto � gi� SCADUTO !! Res / Item 1 / 1504
All character "extend" are wrong encoding (è à).
Any Hints ? Thanks a lot
-- Alex Fustini Mysql Developer 5 Certified Mysql Dba 5 Certified

Hello Alex, Regarding jira, although not a requirement, it would be easier to conduct this discussion if you were registered (in jira). Anyway, support for charset encoding in SMTPAppender was introduced in logback 0.9.14. You reported using logback 0.9.11. Could you please try with the latest version of logback, namely 0.9.14? I am using a modified version of chapter4.mail.EMail application. See [1] for actual code. This application is quite trivial. It configures logback, and logs several debug messages followed by an error message. I modified the code so that messages contained special characters with accents. An edited version of a resulting mail as received by my mail client (Thunderbird) is attached to this message. At this stage, I suggest that you upgrade to logback 0.9.14 and if that does not work, send us a resulting message in the form of a file. HTH, [1] http://logback.qos.ch/xref/chapter4/mail/EMail.html alex wrote:
Sorry Ceki , I give you more information for debug if possible : The code run on Resin 3.1.6 using java 1.6.0.6, logback 0.9.11., slf4j ver 1.5.5 and using Thunderbird 2.0.0.19 to read
Do you use a stand alone application to test it ? Is possible to have the code for test in my enviroment ?
Thanks a lot for all
PS Sorry I do not understand if is possible to me to continue on jiira to continue the description.. Should I register to do that ? -- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch
Date: Fri, 16 Jan 2009 11:04:02 +0100 (CET) From: ceki@qos.ch To: ceki@qos.ch Message-ID: <26680060.01232100242953.JavaMail.ceki@Orion> Subject: chapter4.mail.EMail - At last an error. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_0_1259414.1232100242859" ------=_Part_0_1259414.1232100242859 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2009-01-16 11:04:02,703 DEBUG chapter4.mail.EMail - =C3=A9 gi=C3=A0 SCADUT= O [snip] 2009-01-16 11:04:02,765 ERROR chapter4.mail.EMail - At last an error. java.lang.Exception: Just testing =09at chapter4.mail.EMail.main(EMail.java:54) [classes/:na] ------=_Part_0_1259414.1232100242859--

Hi Ceki , I updated logback to 0.9.14. and slf4j to 1.5.6 and now the enconding of character in email is ok !! Thanks a lot for all Ceki Gulcu wrote:
Hello Alex,
Regarding jira, although not a requirement, it would be easier to conduct this discussion if you were registered (in jira).
Anyway, support for charset encoding in SMTPAppender was introduced in logback 0.9.14. You reported using logback 0.9.11. Could you please try with the latest version of logback, namely 0.9.14?
I am using a modified version of chapter4.mail.EMail application. See [1] for actual code. This application is quite trivial. It configures logback, and logs several debug messages followed by an error message. I modified the code so that messages contained special characters with accents.
An edited version of a resulting mail as received by my mail client (Thunderbird) is attached to this message.
At this stage, I suggest that you upgrade to logback 0.9.14 and if that does not work, send us a resulting message in the form of a file.
HTH,
[1] http://logback.qos.ch/xref/chapter4/mail/EMail.html
alex wrote:
Sorry Ceki , I give you more information for debug if possible : The code run on Resin 3.1.6 using java 1.6.0.6, logback 0.9.11., slf4j ver 1.5.5 and using Thunderbird 2.0.0.19 to read
Do you use a stand alone application to test it ? Is possible to have the code for test in my enviroment ?
Thanks a lot for all
PS Sorry I do not understand if is possible to me to continue on jiira to continue the description.. Should I register to do that ? -- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch
------------------------------------------------------------------------
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
-- Alex Fustini Mysql Developer 5 Certified Mysql Dba 5 Certified

Yes, I saved it with Thunderbird 2.0.0.19 Thorbjørn Ravn Andersen wrote:
alex skrev den 15-01-2009 10:02:
Hi, I configured my SMTPAppender like this
<
Could you export one of the troublesome mails to a file (Outlook uses EML) and attach it to the issue?
-- Alex Fustini Mysql Developer 5 Certified Mysql Dba 5 Certified

alex skrev den 16-01-2009 08:20:
Yes, I saved it with Thunderbird 2.0.0.19
I see that your issue was resolved by upgrading. Good :) I took a quick look. Even if the encoding is explicitly set to be UTF-8, the body of the attachment is in quoted-printable, so AFAIK that keeps the text in plain ASCII. It is much easier to identify such issues on the original data :) -- Thorbjørn Ravn Andersen "...plus... Tubular Bells!"
participants (3)
-
alex
-
Ceki Gulcu
-
Thorbjørn Ravn Andersen