python UnicodeEncodeError

Summary

Use of Unicode characters in python scripts throws a UnicodeEncodeError exception when run from a pipeline.

This does not happen when running the same scripts manually (i.e. directly in a shell without using a pipeline).

Steps to reproduce

Consider this simple python script:

test.py

print "åååå"

And this job:

.gitlab-ci.yml

job:
  script:
    - python test.py

Actual behavior

A python UnicodeEncodeError exception is thrown and the pipeline fails.

Expected behavior

Running the script manually, on the same server, gives the following output:

$ python test.py 
åååå

Relevant logs and/or screenshots

Running with gitlab-ci-multi-runner 1.11.1 (a67a225)
  on xxx (a11cbd96)
Using Shell executor...
Running on xxx...
Fetching changes...
HEAD is now at 9b09a6c Update .gitlab-ci.yml
Checking out e0410ad3 as master...
Skipping Git submodules setup
$ python test.py
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    print u"åååå"
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
ERROR: Job failed: exit status 1

Environment description

Custom installation.

Shell executor.

GitLab Community Edition 8.14.3 2f0065b

Python2.7

Used GitLab Runner version

$ gitlab-runner --version
Version:      1.11.1
Git revision: a67a225
Git branch:   1-11-stable
GO version:   go1.7.5
Built:        Fri, 03 Mar 2017 12:35:58 +0000
OS/Arch:      linux/amd64