Retrieving a string from DynamoDB that contain Unicode chars, requieres to change the codepage from cp850(ibm850) to cp65001(UTF-8) to prevent an encoding error.
But doing so results in LookupError: unknown encoding: cp65001
.
Command used: aws dynamodb scan --table-name NovelupdateInfo --region eu-west-1 --endpoint-url http://localhost:8000
Windows 10
How have you installed the CLI? If you're using Python 2.x then there is no cp65001
encoding in the list of standard encodings and you'll need to use a different encoding (you can see the list of them at https://docs.python.org/2/library/codecs.html#standard-encodings) or you can upgrade to using Python 3.3+, which does have cp65001
in its standard encodings.
Yes I have the CLI installed. I installed it using the standalone installer.
Did you try Donald's suggestion of using python 3 or using a different encoding?
I did not try to use python. I used lambda to generate a new database on aws and used the web gui to get the info. Using a different encoding resulted in an encoding error if I recall correctly.
If you're using lambda, they offer python 3 these days. Unfortunately there's not anything we can do about the shortcomings of the older python versions.
This is a problem I'm still suffering through. SO has a smart workaround that may work for some (see answer and first comment), but since the CLI ships with Python 2.7 which doesn't have Unicode support (so I'm told), it hasn't fixed all my issues.
We've recently started publishing MSIs with Python 3. You can get them here. Let me know if these help!
Closing due to inactivity
This bug is still alive on Windows 10 64 bit with the latest version: aws-cli/1.15.63 Python/2.7.9 Windows/8 botocore/1.10.62
.
A decent workaround here: https://stackoverflow.com/questions/39301253/can-i-force-aws-cli-to-use-utf-encoding#comment69929145_41344733
As per @joguSD suggestion, reinstalling AWSCLI64 (upgraded MSI installer with Python 3 support) and restarting terminal helped. The error is gone.
@kenorb
Thank you for sharing the Python3 version of installer.
This version should replace the official version,
or, provided with it as an option at least.
An update: the latest Windows installer (https://docs.aws.amazon.com/cli/latest/userguide/install-windows.html) has now corrected this problem -- that is, the "AWS CLI MSI" installer.
The version I get from the latest installer is aws-cli/1.16.169 Python/3.6.0 Windows/10 botocore/1.12.159
, and it no longer exhibits the crash when I upload a file with that encoding.
Most helpful comment
@kenorb
Thank you for sharing the Python3 version of installer.
This version should replace the official version,
or, provided with it as an option at least.