How do you set the default encoding in Jenkins?
If you want to set the encoding on a system level in your Jenkins installation, you can add it as a global properties key-value pair (Jenkins -> Manage Jenkins -> Configure System) with name=LANG
and value=<insert your locale here>
(which in my case equals en_GB.UTF-8
). That way you avoid setting the locale for every Jenkins job.
If you are using the Jenkins Pipeline, you need to set the encoding within the pipeline as:
pipeline { agent {label 'node name'} environment { LC_ALL = 'en_US.UTF-8' LANG = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8' } stages { stage ('XXXX') { steps { echo 'Hello' } } }}