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

If you get the above…

Login

Blog History

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.