4

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 7: invalid start byte

from

RBPC9D9DCDEABCIIGHTCFDFA999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

using

print(str(transaction.signature_message_fragment.decode()))

Can anyone help me how to decode this message using Pyota?

Thanks!

Foxxer
  • 41
  • 2

1 Answers1

2

Your message is:

RB  H
PC  a
9D  l
9D  l
CD  o
EA   
BC  S
II  \xfc
GH  \xdf
TC  e
FD  r
FA  !
99
99
99
99
...

The two tryte pairs II and GH can't be decoded to UTF-8 characters.

>>> s = iota.TryteString(b'RBPC9D9DCDEABCIIGHTCFDFA')
>>> s.encode()
b'Hallo S\xfc\xdfer!'

This happens when you convert ASCII to trytes with the Javascript Library and then try to convert the trytes to UTF-8 with the Python Library.

Since UTF-8 is supposed to be backwards compatible with ASCII this shouldn't be a problem. But the iota.lib.js-ASCII is Extended ASCII which UTF-8 is not compatible with.

Since all the libraries should be compatible, I submitted an issue here.

Zauz
  • 4,454
  • 15
  • 42
  • Hello Zaus, thanks for your answer! The original message is "Hallo Süßer!". Those are UTF-8 chars (c3bc and c39f). I created the message by just typing it into Trinity while sending a transaction. Any ideas? – Foxxer Jun 27 '18 at 08:07
  • Seems like Trinity and Pyota use different methods. s = iota.TryteString.from_unicode('Süß')' and s.decode() works fine... – Zauz Jun 27 '18 at 08:23