awslogs icon indicating copy to clipboard operation
awslogs copied to clipboard

Improve UTF8 support

Open eduard93 opened this issue 1 year ago • 1 comments

If logs contained non ASCII characters, awslogs get could fail with:

UnicodeEncodeError: 'charmap' codec can't encode characters in position: character maps to <undefined>

In print(' '.join(output))

This commit forces all output to be UTF8 encoded bytes.

eduard93 avatar Oct 11 '23 16:10 eduard93

For me it failed on ▓ character.

eduard93 avatar Oct 11 '23 16:10 eduard93

Bump. I've experienced this problem myself

UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f512' in position 345: character maps to <undefined>

This will also likely close issues:

  • https://github.com/jorgebastida/awslogs/issues/99
  • https://github.com/jorgebastida/awslogs/issues/121
  • https://github.com/jorgebastida/awslogs/issues/147
  • https://github.com/jorgebastida/awslogs/issues/156
  • https://github.com/jorgebastida/awslogs/issues/157
  • https://github.com/jorgebastida/awslogs/issues/165
  • https://github.com/jorgebastida/awslogs/issues/215
  • https://github.com/jorgebastida/awslogs/issues/255
  • https://github.com/jorgebastida/awslogs/issues/273
  • https://github.com/jorgebastida/awslogs/issues/299
  • https://github.com/jorgebastida/awslogs/issues/300
  • https://github.com/jorgebastida/awslogs/issues/339
  • https://github.com/jorgebastida/awslogs/issues/348
  • https://github.com/jorgebastida/awslogs/issues/364
  • https://github.com/jorgebastida/awslogs/issues/366
  • https://github.com/jorgebastida/awslogs/issues/376

Change set LGTM.

Tristan-Lynass avatar Mar 26 '24 03:03 Tristan-Lynass

Thank you very much for your suggestion. I'll need to refresh my head, but I don't think output could actually be something other than a list. Will ammend the code and release a new version.

jorgebastida avatar Apr 02 '24 07:04 jorgebastida