-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding Ö (O-Umlaut) error in command 'aws ec2 describe-instances' when redirecting to a file #742
Comments
What version of the CLI are you running? There's a similar bug filed a while back that was fixed in later releases. |
Ah found it: #721 |
1.3.6— On Fri, Apr 4, 2014 at 11:46 PM, James Saryerwinnie
|
Interesting, not seeing that issue:
It might also be an issue with the terminal encoding. For example, I have my terminal set to use utf-8. We encode the output based on the encoding of sys.stdout. You can check this with:
|
error still there........I just reproduced it and the terminal encoding is UTF-8: $ aws --version |
Ahh, that's the issue, we don't handle the case when we redirect stdout to a file. Reopening... |
In python2, if a stream has no encoding, unicode is encoded using the default encoding. In python3, sys.stdout is already text based (it expects str() types). In python2, we introduce a compat layer that will give you a stream writer that accepts unicode and encodes the contents into the local.preferredencoding(). Simple repro: tag an ec2 instance with a unicode char and run: aws ec2 describe-instances | grep TAGS You'll get a ascii encode error. With this change you won't. Fixes aws#742.
In python2, if a stream has no encoding, unicode is encoded using the default encoding. In python3, sys.stdout is already text based (it expects str() types). In python2, we introduce a compat layer that will give you a stream writer that accepts unicode and encodes the contents into the local.preferredencoding(). Simple repro: tag an ec2 instance with a unicode char and run: aws ec2 describe-instances | grep TAGS You'll get a ascii encode error. With this change you won't. Fixes aws#742.
In python2, if a stream has no encoding, unicode is encoded using the default encoding. In python3, sys.stdout is already text based (it expects str() types). In python2, we introduce a compat layer that will give you a stream writer that accepts unicode and encodes the contents into the local.preferredencoding(). Simple repro: tag an ec2 instance with a unicode char and run: aws ec2 describe-instances | grep TAGS You'll get a ascii encode error. With this change you won't. Fixes aws#742.
In python2, if a stream has no encoding, unicode is encoded using the default encoding. In python3, sys.stdout is already text based (it expects str() types). In python2, we introduce a compat layer that will give you a stream writer that accepts unicode and encodes the contents into the local.preferredencoding(). Simple repro: tag an ec2 instance with a unicode char and run: aws ec2 describe-instances | grep TAGS You'll get a ascii encode error. With this change you won't. Fixes aws#742.
* release-1.3.7: (28 commits) Bumping version to 1.3.7 Add #742 to changelog Add a comment about why get_stdout_text_writer is needed. Code review feedback Py3 integ test fixes Update changelog with #749 Add compat layer for text based stream writers Fix S3 sync issue with keys containing urlencode values Add issue to changelog Remove print statement in test Fix issue with scalar/non-scalar lists Fix doc example for s3api put-object Refactor load-cli-arg common event code Add 750 to the changelog Update paramfile custom argument to use events Aggregate dupe keys into a list in datapipeline translation Add issue to CHANGELOG Do not auto parse JSON based on filename Update tests to not mock __builtin__.open Allow custom param values to be read from files/urls ...
we have a tag value with an Ö (O-Umlaut) in the string value.
"aws ec2 describe-instances --output=json" works just fine
"aws ec2 describe-instances --output=text (or output=table" gives the following error:
'ascii' codec can't encode character u'\xf6' in position 60: ordinal not in range(128)
I'd expect it to either go consistently wrong in all output formats or consistently go without error in all output formats.
The text was updated successfully, but these errors were encountered: