Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-7997

Changelog read from JellyScript

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: email-ext-plugin
    • Labels:
      None
    • Environment:
      WindowsXP
    • Similar Issues:

      Description

      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?

        Attachments

          Activity

          Hide
          adakd 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...

          Show
          adakd 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...
          Hide
          adakd 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...

          Show
          adakd 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...
          Hide
          slide_o_mix 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.

          Show
          slide_o_mix 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.
          Hide
          scm_issue_link 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.
          Show
          scm_issue_link 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.
          Hide
          slide_o_mix Alex Earl added a comment -

          Added charset to ByteArrayOutputStream.toString

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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: