bashdockerjenkinscharacter-encodingjenkins-agent

Docker Jenkins slave wrong character encoding


I'm using this Jenkins slave docker image, it is based on ubuntu:14.04

I would like to use a String Parameter which contains UTF-8 characters.

The charachers like öüóőúűáéí (Hungarian characters) will be replaced with question marks.

As this ticket mentions I tried to pass -e LANG=hu_HU.UTF-8 and bash -c "locale-gen hu_HU.UTF-8" to Docker. I also placed export LANG=hu_HU.UTF-8 in Jenkins user's .bashrc, but the characters are still being replaced. I also tried with en_US.UTF-8

I also tried to do the same with the 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=    

The output is the same.


Solution

  • I found the solution:

    bash -c "locale-gen hu_HU && locale-gen hu_HU.UTF-8 && update-locale &&  echo 'export LANG=hu_HU.UTF-8' > /jenkins/.bashrc"