FG
☁️ Cloud & DevOpsAmazon

Unicode characters in s3 command: 'ascii' codec can't encode characters in position 32-33: ordinal not in range(128)

Freshalmost 5 years ago
Mar 14, 20260 views
Confidence Score85%
85%

Problem

I've seen similar questions asked for different aws-cli products, and the answer always has to do with the locale, though the asker, like myself, generally has their locale in order. [code block] How can I force using a different codec instead of ascii?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
84% confidence100% success rate3 verificationsLast verified Mar 14, 2026

Solution: Unicode characters in s3 command: 'ascii' codec can't encode characters in position 32-33: ordinal not in range(128)

Low Risk

Running into a similar problem trying to use `aws s3 ls s3://$BUCKET/` : 'ascii' codec can't encode character u'\xe9' in position 181: ordinal not in range(128) my locale is 'en_CA.UTF-8' aws-cli/1.11.44 Python/2.6.6 Linux/2.6.32-042stab093.4 botocore/1.5.7 (using CentOS 6.9 + cPanel, what the webhosting company gave me to use.) Could not reproduce on another machine that is using Pyt

84

Trust Score

3 verifications

100% success
  1. 1

    Running into a similar problem trying to use `aws s3 ls s3://$BUCKET/` :

    Running into a similar problem trying to use `aws s3 ls s3://$BUCKET/` :

  2. 2

    'ascii' codec can't encode character u'\xe9' in position 181: ordinal not in ran

    'ascii' codec can't encode character u'\xe9' in position 181: ordinal not in range(128)

  3. 3

    my locale is 'en_CA.UTF-8'

    aws-cli/1.11.44 Python/2.6.6 Linux/2.6.32-042stab093.4 botocore/1.5.7 (using CentOS 6.9 + cPanel, what the webhosting company gave me to use.)

  4. 4

    Could not reproduce on another machine that is using Python 2.7 and Ubuntu 14.04

    Could not reproduce on another machine that is using Python 2.7 and Ubuntu 14.04 (instead of webhost-enforced CentOS + cPanel).

Validation

Resolved in aws/aws-cli GitHub issue #1437. Community reactions: 2 upvotes.

Verification Summary

Worked: 3
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

awscliclouds3localeunicoderesponse-requested