aws cli – can’t encode character ‘\uxxx’ surrogates not allowed

Written by James McDonald

April 12, 2018

If you get the above when trying to do an aws s3 sync then check your LANG settings… for some reason inside a docker container I had no LANG=en_AU.UTF-8 set and so the aws cli could not encode the romantic little love hearts and weird characters that people embed in photo filenames these days.

So my solutions was to create the correct LANG environment vars as follows

Install locales

apt-get install locales

locale-gen en_AU.UTF-8

export LANG=en_AU.UTF-8
export LC_ALL=en_AU.UTF-8
export LANGUAGE=en_AU.UTF-8

and then:

aws s3 sync Blah s3://bucketname/Path/Blah

I found that setting the LANG vars in /etc/default/locale or /etc/environment and restarting the container did bubkiss (didn’t work).


Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

Toggen builds a new website

So I have built and hosted a new website for Roger Clark Pest Management they are a family owned and operated Pest...


Just downloaded WizTree (not a sponsor) from It seems to do what it says on the tin which is...

Scam call from “Telstra”

Just had a call from a man with a sub-continental accent from caller ID 0734946596 Told me there was problem with my...