Wrong characters after I restored my jenkins_home

Hi everyone,

I have exhausted the possible solutions I have found on internet before posting my issue here and I’m hoping someone has faced a similar problem or at least could offer me some idea of what could be happening here.
In one of my declarative pipelines I have something like this:

def status = "Failed 🔴"
...
str = "#### terraform plan ${status}\n ${planResult}<details><summary>Show Output</summary>\n\n```hcl\n${output}\n```\n</details>\n\n*Dataset: `${ds}`, Working Directory: `${tfWorkingDir}`*"
def comment = pullRequest.comment(str)

previous code is supposed to write a pull request comment with the text from str. The pipeline was working as expected before I needed to extend the size of the disk/volume dedicated to my jenkins_home. After this event, my Jenkinsfile hasn’t changed in any way but now the pipeline is writing wrong characters on the Pull Request comments (terraform plan failed ����) where it should be writing terraform plan failed 🔴 as before.

To give you more context. My jenkins infrastructure is deployed using official helm chart and recently changed the storageClass of the PV used for jenkins_home, for that reason I needed to back it up from the old volume and restore it on the new one. The backup process was manually executed and I basically have compressed the entire jenkins_home using standard options of tar, provisioned the new PV and then uncompressed the backup on the new volume.

Internet search results have suggested this could be related to file encoding so I tried using -Dfile.encoding=UTF8 without any positive result. I don’t really get what could be the issue here since jenkins is supposed to pull from my github repo the Jenkinsfile with the right encoding and characters.
Thank you in advance

if you echo the string to the console is it right? That would narrow it down from jenkins vs git vs apis etc

If your jenkinsfile hasn’t changed from before to after the restore, its possible that there’s a cache somewhere that broke. Cleanup the /var/lib/jenkins/caches folder - Stack Overflow seems to be where i’d start for that problem.

There was an inadvertent change in Jenkins 2.303.1 that caused the locale of the Docker image for the Jenkins controller (jenkins/jenkins:2.303.1, jenkins/jenkins:lts, jenkins/jenkins:lts-jdk8, and jenkins/jenkins:slim) to be switched from the internationalized C.UTF-8 to the US-ASCII POSIX locale. You might check “Manage Jenkins” → “System Information” to confirm the locale settings of your Jenkins controller allow international characters.

Look for the value of the environment variable LANG. Will be fixed in the 2.303.2 release next Wednesday, Oct 6, 2021.

1 Like

Cache was the issue. I thought I have excluded that directory but I didn’t. When you mentioned it @halkeye, I looked at the options I used excluding cache and it wasn’t right? Thank you for the suggestion. Also thank you @MarkEWaite to mention this issue.

tar -cpzf /mnt/backup-vol/ci-backup-$(date +%Y-%m-%d).tar jenkins_home/ \
   --exclude='jenkins_home/lost+found' \
   --exclude='jenkins_home/logs' \
   --exclude='jenkins_home/war' \
   --exclude='jenkins_home/*.bak' \
   --exclude='jenkins_home/*.cache'