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!

1 Answer 1

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.

2
  • 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
    Commented Jun 27, 2018 at 8:07
  • Seems like Trinity and Pyota use different methods. s = iota.TryteString.from_unicode('Süß')' and s.decode() works fine...
    – Zauz
    Commented Jun 27, 2018 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.