Jenkins git-插件编码转换乱码?
Garbled characters by Jenkins git-plugin encoding conversion?
[Problem] When we look at changes, commit log is garbled.
据报道here. And I verified that the reason is just as hayarobi Park评论:
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.
我的验证过程如下:
- 从“[Jenkins 项目名称]/builds/[内部版本号]/”文件夹中获取 changelog.xml 文件。 notepad.exe告诉它的编码是utf8,但是乱码存在于所有可能的编码(包括utf8/ucs16/[gbk]等)查看。
- 然后我将其编码从 utf8 转换为我的 windows 本地编码 gbk。乱码字符仍然按预期存在,因为 changelog.xml 从作为 gbk 处理的 utf8 转换为 utf8,如 hayarobi Park 所述。
- 然后我查看了utf8编码的changelog.xml,乱码不见了!
所以我尝试通过配置 git 日志消息编码从默认 utf8 到 gbk 来解决问题。奇怪的是,虽然changelog.xml文件已经gbk编码,可以正常查看了,但Jenkins的change log页面仍然存在乱码。
那我不知道下一步该怎么做...
在 cmd 上试试这个
git config --global i18n.commitEncoding cp949
git config --global i18n.logOutputEncoding cp949
或者将编码更改为您需要的任何内容。它对我很好用!
[Problem] When we look at changes, commit log is garbled.
据报道here. And I verified that the reason is just as hayarobi Park评论:
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.
我的验证过程如下:
- 从“[Jenkins 项目名称]/builds/[内部版本号]/”文件夹中获取 changelog.xml 文件。 notepad.exe告诉它的编码是utf8,但是乱码存在于所有可能的编码(包括utf8/ucs16/[gbk]等)查看。
- 然后我将其编码从 utf8 转换为我的 windows 本地编码 gbk。乱码字符仍然按预期存在,因为 changelog.xml 从作为 gbk 处理的 utf8 转换为 utf8,如 hayarobi Park 所述。
- 然后我查看了utf8编码的changelog.xml,乱码不见了!
所以我尝试通过配置 git 日志消息编码从默认 utf8 到 gbk 来解决问题。奇怪的是,虽然changelog.xml文件已经gbk编码,可以正常查看了,但Jenkins的change log页面仍然存在乱码。
那我不知道下一步该怎么做...
在 cmd 上试试这个
git config --global i18n.commitEncoding cp949
git config --global i18n.logOutputEncoding cp949
或者将编码更改为您需要的任何内容。它对我很好用!