-1

I'm working with some interesting devices and some of them uses micropython and on this part have problem with encodings.

I need to make two devices communicating by UART-protocol.

First device (may it be Nextion Display) sends to second device (STM-32 with micropython on board) string 'hellobruh' via UART,

second device gets bytesarray b'\x80\x9ef\x06\x9e\xe0\x9e\xfe\x9e\x18\x86\xf8f~\x80\x9e'

so the first thing I should try in my python script is to use .decode('utf-8') but no encodings works to decode it back to 'hellobruh'. I've tried windows-1251, cp-***, iso-****-*, ascii. Tried also with just usual python3 - no results, so I've put all these tags here - problem is not special for any devices. What am i doing wrong? This example is so simple as helloworld app on any platform/lang, so I think it is not incorrent settings setted by me or any hardware problem, I think it is just I don't understand in full way which encoding I get on second device or how to decode it. Thanks to all!

  • Welcome to [Stack Overflow.](https://stackoverflow.com/ "Stack Overflow") Please be aware this is not a code-writing or tutoring service. We can help solve specific, technical problems, not open-ended requests for code or advice. Please edit your question to show what you have tried so far, and what specific problem you need help with. See the [How To Ask a Good Question](https://stackoverflow.com/help/how-to-ask "How To Ask a Good Question") page for details on how to best help us help you. – itprorh66 Aug 03 '21 at 23:15
  • @itprorh66 welcome to my question. You should reread my question. *I've tried windows-1251, cp-\*\*\*, iso-\*\*\*\*-\*, ascii.* and specific problem is to define encoding of my bytesarray. There is no any requesting for code or any done solutions. There is question "What am I doing wrong?". – dictumfactum Aug 03 '21 at 23:26
  • You might get an answer on [electronics.se], as this seems to be more a hardware protocol issue; at a wild guess, it's a compression, not encoding, issue here. – Ken Y-N Aug 04 '21 at 01:55
  • This site is best used once you have a specific problem that you can't figure out, general questions asking for guidance doesn't fit with SO's objectives. – itprorh66 Aug 04 '21 at 13:35
  • Ken Y-N, thank you, will try. It may be what you’re saying. – dictumfactum Aug 04 '21 at 20:40
  • @itprorh67, I have specific problem - one string does not equivalents other in that conditions in which it should be equivalent. Where are there any general questions? I can understand why you’re trying to teach me something, but reread please my question again and show me where I didn’t wrote what I had already tried, where my questions are not concrete and where I have any differences in my question's objectives and in SO’s objectives. – dictumfactum Aug 04 '21 at 20:49

1 Answers1

0

Be very careful when working with any devices. If you think it should be encoding problem, it could be wrong baudrate as example, which problem I got in this stuff. Even if it looks like you're doing all well and without errors. Question is solved.