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).

0 Comments

Submit a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Clear HSTS Settings in CHrome

Open chrome://net-internals/#hsts enter the domain in the query field and click Query to confirm it has HSTS settings...

Ubuntu on Hyper-v

It boils town to installing linux-azure # as root or sudo apt-get update apt-get install linux-azure...