• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • email-ext-plugin
    • None
    • WindowsXP

      Use the Jelly Script Template from version 2.9. I found that if SVN Checkin log has Chinese. It will show the Chinese as (鏇挎崲鍐欏箍鎾姛鑳藉尯鐨勮创鍥惧苟淇敼鍔ㄧ敾鐨勫疄鐜� . Is it the Jelly Script doesn`t support UTF-8?

          [JENKINS-7997] Changelog read from JellyScript

          What is the "Content-type" header of the e-mail you get?

          Kohsuke Kawaguchi added a comment - What is the "Content-type" header of the e-mail you get?

          kutzi added a comment -

          No info from reporter => closing

          kutzi added a comment - No info from reporter => closing

          Diptiman Adak added a comment -

          I have got the same problem.
          In Jelly script ${build.durationString}is not displayed properly
          But I am getting the same problem in Windows Chinese Version.Linux PC is working fine.
          My Content-type is HTML

          Diptiman Adak added a comment - I have got the same problem. In Jelly script ${build.durationString}is not displayed properly But I am getting the same problem in Windows Chinese Version.Linux PC is working fine. My Content-type is HTML

          Alex Earl added a comment -

          You should be able to set the content-type of the email in the global config. Please try this and see if it helps.

          Alex Earl added a comment - You should be able to set the content-type of the email in the global config. Please try this and see if it helps.

          Diptiman Adak added a comment -

          I want to add some more information for this issue.I have added some Chinese text in the Global configuration page in the in the Default Content textbox.Those Chinese characters are displaying properly.But if I added any Chinese characters inside the jelly script that character is not displaying properly.

          Another important thing is that other strings in the Jelly Script is displaying in Chinese

          <TR><TD>Build URL</TD><TD><A href="${rooturl}${build.url}">${rooturl}${build.url}</TD></TR>
          <TR><TD>Project:</TD><TD>${project.name}</TD></TR>
          <TR><TD>Date of build:</TD><TD>${it.timestampString}</TD></TR>
          <TR><TD>Build duration:</TD><TD>${build.durationString}</TD></TR>

          Except ${build.durationString} all other strings are displaying in English in mail whether the other characters are displaying properly in Jenkins page.
          Now I have modified the JellyScriptContent.java
          This function I have modified to add utf-8 encoding....
          private String renderContent(AbstractBuild<?, ?> build, InputStream inputStream)
          throws JellyException, IOException {
          JellyContext context = createContext(new ScriptContentBuildWrapper(build), build);

          Reader reader = new InputStreamReader(inputStream,"UTF-8");
          InputSource input = new InputSource(reader);
          input.setEncoding("UTF-8");

          Script script = context.compileScript(input);
          if (script != null)

          { return convert(context, script); }

          return null;
          }

          But nothing is working.I am not able to set the UTF-8 for jelly script.In jelly script i tried with
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
          </head>

          Slide has pointed out to set the content type...It is set as html....Now I dont know anything more we need to do except that or not..Today I have tested with all the Jelly scripts that is in the email ext plugins and same problem is there...Only the build.durationstring is not coming in Chinese which not proper...For groovy I am not sure , Tomorrow I will check with groovy...

          Diptiman Adak added a comment - I want to add some more information for this issue.I have added some Chinese text in the Global configuration page in the in the Default Content textbox.Those Chinese characters are displaying properly.But if I added any Chinese characters inside the jelly script that character is not displaying properly. Another important thing is that other strings in the Jelly Script is displaying in Chinese <TR><TD>Build URL</TD><TD><A href="${rooturl}${build.url}">${rooturl}${build.url}</TD></TR> <TR><TD>Project:</TD><TD>${project.name}</TD></TR> <TR><TD>Date of build:</TD><TD>${it.timestampString}</TD></TR> <TR><TD>Build duration:</TD><TD>${build.durationString}</TD></TR> Except ${build.durationString} all other strings are displaying in English in mail whether the other characters are displaying properly in Jenkins page. Now I have modified the JellyScriptContent.java This function I have modified to add utf-8 encoding.... private String renderContent(AbstractBuild<?, ?> build, InputStream inputStream) throws JellyException, IOException { JellyContext context = createContext(new ScriptContentBuildWrapper(build), build); Reader reader = new InputStreamReader(inputStream,"UTF-8"); InputSource input = new InputSource(reader); input.setEncoding("UTF-8"); Script script = context.compileScript(input); if (script != null) { return convert(context, script); } return null; } But nothing is working.I am not able to set the UTF-8 for jelly script.In jelly script i tried with <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </head> Slide has pointed out to set the content type...It is set as html....Now I dont know anything more we need to do except that or not..Today I have tested with all the Jelly scripts that is in the email ext plugins and same problem is there...Only the build.durationstring is not coming in Chinese which not proper...For groovy I am not sure , Tomorrow I will check with groovy...

          Diptiman Adak added a comment -

          I checked with groovy template ....here it is proper....So problem remains in Jelly script only....In the ExtendedEmailPublisher.java also I printed the charset its coming UTF-8...

          Diptiman Adak added a comment - I checked with groovy template ....here it is proper....So problem remains in Jelly script only....In the ExtendedEmailPublisher.java also I printed the charset its coming UTF-8...

          Alex Earl added a comment -

          Sorry, I meant set the charset option, not the content-type. You should be able to do that in the global config.

          Alex Earl added a comment - Sorry, I meant set the charset option, not the content-type. You should be able to do that in the global config.

          Code changed in jenkins
          User: slide
          Path:
          src/main/java/hudson/plugins/emailext/plugins/content/JellyScriptContent.java
          src/test/java/hudson/plugins/emailext/plugins/ContentBuilderTest.java
          src/test/java/hudson/plugins/emailext/plugins/ContentBuilderTokenizerTest.java
          src/test/java/hudson/plugins/emailext/plugins/content/JellyScriptContentTest.java
          http://jenkins-ci.org/commit/email-ext-plugin/36cd102e55cded1c8636a9c8bed4961bea06fd1b
          Log:
          Fix JENKINS-7997

          • Set the output encoding for the ByteArrayOutputStream.toString method based on the charset from the plugin.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: slide Path: src/main/java/hudson/plugins/emailext/plugins/content/JellyScriptContent.java src/test/java/hudson/plugins/emailext/plugins/ContentBuilderTest.java src/test/java/hudson/plugins/emailext/plugins/ContentBuilderTokenizerTest.java src/test/java/hudson/plugins/emailext/plugins/content/JellyScriptContentTest.java http://jenkins-ci.org/commit/email-ext-plugin/36cd102e55cded1c8636a9c8bed4961bea06fd1b Log: Fix JENKINS-7997 Set the output encoding for the ByteArrayOutputStream.toString method based on the charset from the plugin.

          Alex Earl added a comment -

          Added charset to ByteArrayOutputStream.toString

          Alex Earl added a comment - Added charset to ByteArrayOutputStream.toString

            slide_o_mix Alex Earl
            ttaqt ttaqt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: