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

Git plugin uses default encoding to read change log file

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None
    • Windows Server 2003 R2, Cygwin 1.7.2, git 1.7.0.4, Hudson 1.353, GIT plugin 0.8.2

      [Problem]
      When we look at changes, commit log is garbled.

      [Cause]
      Git assumes that commit log is written by utf-8, if we don't set "i18n.commitencoding" property.

      hudson.plugins.git.GitChangeLogParser class uses java.io.FileReader class at 27.
      java.io.FileReader class uses the default character encoding to read file.
      Japanese version of Windows uses "MS932" as default character encoding.

      So we run hudson on it, commit log is garbled.

      [Solution]
      use java.io.FileInputStream and java.io.InputStreamReader classes instead of java.io.FileReader class.
      java.io.InputStreamReader class has a constructor that is able to set the encoding.

      [Example]
      BufferedReader rdr = null;
      try {
      // fetch encoding out of configuration
      rdr = new BufferedReader(new InputStreamReader(new FileInputStream(changelogFile), encoding));
      /* ... */
      } finally {
      // close rdr whether constructors throw exception or not
      if (rdr != null) rdr.close();
      }

          [JENKINS-6203] Git plugin uses default encoding to read change log file

          bleis created issue -
          sogabe made changes -
          Assignee New: magnayn [ magnayn ]

          Andrew Bayer added a comment -

          Resolved

          Andrew Bayer added a comment - Resolved
          Andrew Bayer made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          dogfood added a comment -

          dogfood added a comment - Integrated in plugins_hudson-git-plugin #35

          Anton Smirnov added a comment -

          1. perform git commit in utf-8 (russian alphabet).
          2. build done with wrong changes description (??? instead of russian letters).

          "git log" displays right discription (russian letters) in cloned jenkins repository (in '..\jobs%project_name%\workspace).
          tortoiseGit displays right log messages (in utf-8, i.e. commit is done in utf-8 definitely)

          environment:
          windows 7 professional,
          system default encoding is win1251,
          jenkins 1.405,
          git-plugin 1.1.6,
          msysgit-1.7.? (git 1.7.1)

          Anton Smirnov added a comment - 1. perform git commit in utf-8 (russian alphabet). 2. build done with wrong changes description (??? instead of russian letters). "git log" displays right discription (russian letters) in cloned jenkins repository (in '..\jobs%project_name%\workspace). tortoiseGit displays right log messages (in utf-8, i.e. commit is done in utf-8 definitely) environment: windows 7 professional, system default encoding is win1251, jenkins 1.405, git-plugin 1.1.6, msysgit-1.7.? (git 1.7.1)
          Anton Smirnov made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Anton Smirnov made changes -
          Assignee Original: magnayn [ magnayn ] New: Anton Smirnov [ adept ]

          Anton Smirnov added a comment -

          debugged it and checked:
          private String computeChangeLog(...) in GitSCM.java
          returns right log description, but the problems remains.

          Jenkins build page still contains wrong text.
          Moving issue to Jenkins issues...

          Anton Smirnov added a comment - debugged it and checked: private String computeChangeLog(...) in GitSCM.java returns right log description, but the problems remains. Jenkins build page still contains wrong text. Moving issue to Jenkins issues...
          Anton Smirnov made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Reopened [ 4 ] New: Resolved [ 5 ]

            ndeloof Nicolas De Loof
            bleis bleis
            Votes:
            10 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved: