Skip to content

Getting the instance serial console log produces encoding error #5558

Closed

Description

@rabits

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

Describe the bug
Serial console sometimes contains weird chars and on Windows it could be an issue, because default decoder/encoder could vary.

SDK version number
aws-cli/2.0.50 Python/3.7.7 Windows/10 exe/AMD64

Platform/OS/Hardware/Device
Windows 10

To Reproduce (observed behavior)

  1. Create instance
  2. Request serial console log: aws.exe --output json --region us-west-1 ec2 get-console-output --instance-id i-064f866083905a5bd

Expected behavior
I think setting the encoding/decoding to utf-8 should fix the issue with cross-platform differences.

Logs/output

aws.exe --output json --region us-west-1 ec2 get-console-output --instance-id i-064f866083905a5bd
{
    "InstanceId": "i-064f866083905a5bd",
    "Output":
'charmap' codec can't encode character '\u2192' in position 66745: character maps to <undefined>

Additional context
Actually produced with any output - json or text doesn't matter.

Activity

  1. kdaily commented on Sep 28, 2020

    @kdaily
    Member

    Hi @rabits, thanks for opening. I think I've encountered this before (#4778). The current solution is to enable UTF-8 as in the Windows system locale, as described here:

    https://stackoverflow.com/questions/57131654/using-utf-8-encoding-chcp-65001-in-command-prompt-windows-powershell-window/57134096#57134096

  2. added
    bugThis issue is a bug.
    response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.
    and removed
    needs-triageThis issue or PR still needs to be triaged.
    on Sep 28, 2020
  3. rabits commented on Sep 28, 2020

    @rabits
    Author

    Hi @kdaily , yeah I think it's related - but in my case I have no way to rule the host locale. My application just uses the current aws installation. I think the AWS tool should work properly in all the locales available on the host platform, but that's great to know there is a workaround. Thank you

  4. kdaily commented on Sep 28, 2020

    @kdaily
    Member

    Agree! As noted in the other post is that set PYTHONIOENCODING=UTF-8 works for the V1 client, but not V2. This needs to be investigated.

  5. added and removed
    response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.
    on Dec 11, 2020
  6. self-assigned this
    on Nov 2, 2022
  7. tim-finnigan commented on Nov 2, 2022

    @tim-finnigan
    Contributor

    This error has been previously reported a few times. For the AWS CLI v2 I think #5086 addresses the issue, specifically in this comment.

    You can find a section on Locale here in the AWS CLI documentation. For Windows it notes:

    ...if you use Windows with default encoding CP1252, setting AWS_CLI_FILE_ENCODING=UTF-8 would make CLI ignore locale encoding and open text files using UTF-8.

    Based on that I believe this issue can be closed. If the above solution does not work please let us know here or create a new issue and we can revisit this. Thanks!

  8. github-actions commented on Nov 2, 2022

    @github-actions
    Contributor

    ⚠️COMMENT VISIBILITY WARNING⚠️

    Comments on closed issues are hard for our team to see.
    If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions