1

我正在使用这个Jenkins slave docker 镜像,它基于 ubuntu:14.04

我想使用一个包含 UTF-8 字符的字符串参数。

öüóőúűáéí(匈牙利字符)这样的字符将被替换为question marks

正如这张票所提到的,我试图通过-e LANG=hu_HU.UTF-8bash -c "locale-gen hu_HU.UTF-8"到达码头。我还放置export LANG=hu_HU.UTF-8到 Jenkins 用户的.bashrc字符仍然被替换。我也试过en_US.UTF-8

我也尝试对 Jenkins Job 做同样的事情:

+ export LANG=hu_HU.UTF-8
+ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=hu_HU.UTF-8
LANGUAGE=
LC_CTYPE="hu_HU.UTF-8"
LC_NUMERIC="hu_HU.UTF-8"
LC_TIME="hu_HU.UTF-8"
LC_COLLATE="hu_HU.UTF-8"
LC_MONETARY="hu_HU.UTF-8"
LC_MESSAGES="hu_HU.UTF-8"
LC_PAPER="hu_HU.UTF-8"
LC_NAME="hu_HU.UTF-8"
LC_ADDRESS="hu_HU.UTF-8"
LC_TELEPHONE="hu_HU.UTF-8"
LC_MEASUREMENT="hu_HU.UTF-8"
LC_IDENTIFICATION="hu_HU.UTF-8"
LC_ALL=    

输出是一样的。

谢谢你。

4

2 回答 2

1

An alternative (and perhaps cleaner) solution is to amend the Job configuration so that the environment variable is injected into the build job.

In the section Build Environment, add the environment variable in the 'Properties Content' field.

I think that this is a cleaner solution as the local jenkins account is not polluted leaving Jenkins installation to take care of the build environment; preferable when you have > 1 slave to maintain local accounts on... This solution is accurate as of Jenkins ver1.613

于 2018-06-06T13:04:45.660 回答
0

我找到了解决方案:

bash -c "locale-gen hu_HU && locale-gen hu_HU.UTF-8 && update-locale &&  echo 'export LANG=hu_HU.UTF-8' > /jenkins/.bashrc"
于 2017-04-07T07:13:46.620 回答