lfree
lfree

Reputation: 2206

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:

I'm running Jenkins on Windows 7 (Korean version, encoding is CP949) with msysgit-1.9.5-xxx. The git repository is on remote Linux machine. I have the issue that recent change message is corrupted.

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 corrupted text.

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:

  1. 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.
  2. 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.
  3. 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...

Upvotes: 1

Views: 1671

Answers (1)

Suyeon
Suyeon

Reputation: 26

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 !

Upvotes: 1

Related Questions