Skip to content

fix unicode string decoding - #60

Open
sc630 wants to merge 1 commit into
JeevanJames:masterfrom
sc630:fix-unicode-decoding
Open

fix unicode string decoding#60
sc630 wants to merge 1 commit into
JeevanJames:masterfrom
sc630:fix-unicode-decoding

Conversation

@sc630

@sc630 sc630 commented Sep 22, 2021

Copy link
Copy Markdown

There was an error in detecting the correct termination bytes of unicode strings. As result the last character of the string was corrupted and one byte was left in the buffer, thus the following data wasn't decoded correctly (in my example a picture frame for title cover). When the data is written back, the frames are encoded correctly, but with the corrupt data in memory.
Example:
the string "The" in unicode is encoded as follows:
$FF $FE $54 $00 $68 $00 $65 $00 $00 $00

  • The first two bytes are the byte order marker (BOM)
  • then, each character is coded with two bytes
  • and the string is terminated with two zero bytes
    The correct begin of the string termination is at index 8 (and not on index 7, where a sequence of zeros begins)

So I implemented the unicode decoding regarding two-byte characters and little-endian or big-endian encoding corresponding to the byte order marker (preamble).
I tryed to simplify the decoding function for better readability and added some comments with the frame specifications for orientation.

also fixed:

  • implement encoding of lyrics frame (decoding available, but encoding was missing - resulting in an exception)
  • add correct decode/encode of TXXX frame (description was missing)

implement encoding of lyrics frame (missing)
add correct decode/encode of TXXX frame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant