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?

Edit
Report