Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set the default encoding in Jenkins?

I have a python script that outputs non-ascii characters. It works fine from the command line (which has LANG en_US.UTF-8), but once I try to run it in Jenkins (launched from the same shell), it fails in the typical manner of an ascii terminal:

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 37: ordinal not in range(128)

I've tried preceeding the script call in the "Execute shell" build step like so:

export LANG=en_US.UTF-8

However, it seems to ignore that. Putting the following in my python script:

print "Encoding = %s" % sys.getdefaultencoding()

Gives me this, no matter what I do:

Encoding = ascii

So is there something that will allow me to force Jenkins to use UTF-8?

like image 868
Karl Avatar asked May 20 '11 18:05

Karl


1 Answers

Never mind, found out how to do it:

export PYTHONIOENCODING=UTF-8
like image 110
Karl Avatar answered Sep 18 '22 07:09

Karl