Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unicode string decoding #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sc630
Copy link

@sc630 sc630 commented Sep 22, 2021

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.

None yet

1 participant