Skip to content

Failed in receiving shadow document due to awsiotsdk SDK wrong encoding 'ascii' instead of 'utf-8' #104

Closed
@asafs932

Description

@asafs932

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Known Issue

  • I'm using ATS data type endpoint: the endpoint should look like <prefix>-ats.iot.<region>.amazonaws.com

Describe the bug
I have added a uni-coded string (not english) inside my-thing shadow document and tried to recieve the updated document on the client side without success.
when i ran (Python2.7) the request of the shadow document i received "None"(which means no document was received) without any error.
After a bit of research i have discovered the following:
1)the old sdk "awsiotpythonsdk" works perfectly good
2)changing the default system encoding from 'asci' to 'utf-8' solved the problem, i added the following lines in my python script (but adding these lines are bad practice)
"
import sys
reload(sys)
sys.setdefaultencoding('UTF8')
"
These led me to the conclusion that there is software bug in the new SDK - the default encoding should be 'utf-8' and not let the system decide it for you.

SDK version number
1.2.1
Platform/OS/Device
What are you running the sdk on?
Linux, Python2.7
To Reproduce (observed behavior)
Steps to reproduce the behavior (please share code)
1)make sure system default encoding is 'asci' - you can verify it by running "python -c 'import sys; print(sys.getdefaultencoding())'"
2)run a python2.7 script to receive a shadow document which includes uni-coded strings (non-English)

result - you will not be able to receive the shadow document.

Expected behavior
i expect that the SDK will encode all incoming mqtt messaged as UTF-8, and will not give the system to decide it.

Logs/output

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions