Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Question regarding non-ascii characters in mail-subject

    Hi Isomorphic,

    I'm using a current 4.1p (v9.1p_2014-09-14) on a Windows 8 machine with Tomcat 7 during development and a CentOS 6 machine with Tomcat 7 in test.

    I have a mail sent like the following:
    Code:
    <operationBinding operationType="fetch" operationId="..." serverMethod="...">
    	<mail contentType="text/html">
    		<from>$customerSettings.customerMailFrom</from>
    		<to>$RECEIPENTLIST</to>
    		<bcc>$customerSettings.customerMailBCC</bcc>
    		[B]<subject>text with üöä umlauts</subject>[/B]
    		<templateFile>mails/mymail.html</templateFile>
    	</mail>
    </operationBinding>
    The mail is sent as expected from my Win 8 machine.
    The same war deployed in CentOS sends mails that have a "?" instead of the umlauts in the mail-subject (works fine in both cases for velocity-expressions returning umlauts in the mail-templateFile).

    It is pretty obvious that this is not related directly to SmartGWT, but perhaps you (or an other user) have an idea for the cause of this.
    The file is UTF-8 without BOM, as all my ds.xml files.

    Best regards,
    Blama

    #2
    Is the mail server you're talking to the same? That would be a difference to eliminate first.

    Also check what the default locale is for your JVM. Maybe you've got UTF8 set in Windows but in your Linux install it's something else.

    You should also check that your .ds.xml files really are stored in UTF8 on Linux. The "file" command-line utility can tell you.

    Comment


      #3
      Hi Isomorphic,

      thanks for the fast answer.
      The file is really UTF-8 (the file is war'd under Win 8, ssh-copied to the server and auto-deployed by Tomcat). Linux file command says: "UTF-8 Unicode text, with CRLF line terminators".

      Java Win8:
      Code:
      C:\Windows\System32>java -version
      java version "1.7.0_67"
      Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
      Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
      Java CentOS 6:
      Code:
      [root@server ~]# java -version
      java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
      The mail server (and even account) is the same. I found a subtle but most likely significant difference when viewing the mail and its headers as plain-text:

      Good (Subject Cp1252):
      Code:
      Return-path: <noreply@myserver.com>
      Envelope-to: noreply@myserver.com
      Delivery-date: Thu, 18 Sep 2014 18:41:56 +0200
      Received: from dialupname.dslprovider.com ([eee.fff.ggg.hhh]:14288 helo=LAPTOP)
      	by mailserver.net with esmtpsa (TLSv1:AES128-SHA:128)
      	(Exim 4.82)
      	(envelope-from <noreply@myserver.com>)
      	id 1XUemK-003vIL-RO; Thu, 18 Sep 2014 18:41:56 +0200
      Date: Thu, 18 Sep 2014 18:41:55 +0200 (CEST)
      From: Noreply Mailsystem <noreply@myserver.com>
      To: Testuser Name <testaccount@gmail.com>
      Cc: Testuser Name <testaccount@gmail.com>
      Message-ID: <389693556.55.1411058515177.JavaMail.mylocalaccount@LAPTOP>
      [B]Subject: =?Cp1252?Q?Vielen_Dank_f=FCr_Ihr?=[/B]
      MIME-Version: 1.0
      Content-Type: text/html; charset=UTF-8
      Content-Transfer-Encoding: 7bit
      Bad (Subject ANSI_X3.4-1968):
      Code:
      Return-path: <noreply@myserver.com>
      Envelope-to: noreply@myserver.com
      Delivery-date: Tue, 23 Sep 2014 14:38:55 +0200
      Received: from [aaa.bbb.ccc.ddd] (port=50554 helo=myserver.com)
      	by mailserver.net with esmtpsa (TLSv1:AES128-SHA:128)
      	(Exim 4.82)
      	(envelope-from <noreply@myserver.com>)
      	id 1XWPMt-000hV1-Hh; Tue, 23 Sep 2014 14:38:55 +0200
      Date: Tue, 23 Sep 2014 14:42:02 +0200 (CEST)
      From: Noreply Mailsystem <noreply@myserver.com>
      To: Testuser Name <testaccount@gmail.com>
      Cc: Testuser Name <testaccount@gmail.com>
      Message-ID: <1761066818.7.1411476122710.JavaMail.root@myserver.com>
      [B]Subject: =?ANSI_X3.4-1968?Q?Vielen_Dank_f=3Fr_Ihr?=[/B]
      MIME-Version: 1.0
      Content-Type: text/html; charset=UTF-8
      Content-Transfer-Encoding: 7bit
      I will look into this now.

      Best regards,
      Blama

      Comment


        #4
        Hi Isomorphic,

        the first google hit had the solution:
        Code:
        System.setProperty("mail.mime.charset", "Cp1252");
        As I send the mails triggered from a Servlet of my own that calls SmartGWT DataSources with mail-operationBindings, I was able to add the code as very first line in the servlet's doGet().

        This is not possible for normal <mail>-tags where you don't have DMI.
        Is it possible to set this setting centrally from server.properties? I'm fine currently, but I think it would be good to have it.

        Best regards,
        Blama

        Comment


          #5
          Glad you solved it.

          We can't really see a purpose to providing a second, parallel way to set system properties via SmartGWT when there are already multiple standard Java ways to do so.

          Comment

          Working...
          X