Garbled characters by Jenkins git-plugin encoding conversion?
[Problem] When we look at changes, commit log is garbled.
as reported here. And I verified that the reason is just as hayarobi Park commented:
- Safe to use any utf-8 character in git commit messages?
- Checkin changes to UTF8 BOM using git
- git, msysgit, accents, utf-8, the definitive answers
- Find a commit which removed UTF-8 signature
- Git, Mac OS X and accented characters
- Convert git repository file encoding
After some testing and debugging git-plugin, I found, at least in my case, that
the log message received from standard output of external git.exe was
already corrupted. So, changelog.xml file in builds directory stores
git-client plugin execute external git.exe like this
command, “git.exe whatchanged –no-abbrev -M –pretty=raw
df1cca6135b7019dbd583693b59f6b97f408f5c5 “, and git.exe out change log
to standard out. git-client plugin takes that output. In this point,
the wrongfully converted message was received to git-client plugin.
The original message was UTF-8, but this message was assumed to
current OS’s encoding(CP949 in my computer) and then wrong encoding
conversion (CP949 to UCS-2) is occured. I don’t yet know which one is
doing this wrong conversion; hudson Locallauncher, get.exe or other.
My verification process is as bellow:
- Get the changelog.xml file from “[Jenkins Project Name]/builds/[Build Number]/” folder. notepad.exe tells its encoding is utf8, but the garbled characters exists in all posible encodings (include utf8/ucs16/[gbk] etc) viewing.
- I then convert its encoding from utf8 to my windows local encoding gbk. Garbles chars still exists as expected, because the changelog.xml is converted from utf8 dealt as gbk to utf8 like hayarobi Park stated.
- I then view the changelog.xml in utf8 encoding, the garbled chars gone!
So I try to solve the problem by config git log message encoding from default utf8 to gbk. What weird is that the the garbled chars still exists in Jenkins’ change log page, although the changelog.xml file has been gbk encoded and can be viewed normally.
Then I’m at a lose for what do to next…
One Solution collect form web for “Garbled characters by Jenkins git-plugin encoding conversion?”
Try this on the cmd
git config --global i18n.commitEncoding cp949 git config --global i18n.logOutputEncoding cp949
Or change the encoding to whatever you need. It worked fine with me !