in reply to Re^2: ID3 tag version 2.4.0 Pack and Unpack (text encoding byte)
in thread ID3 tag version 2.4.0 Pack and Unpack

Before the write, your read program is actually writing out "Third Part Frame id: TPE1 Frame Size: 10 Flags: \0An artist" and "Third Part Frame id: TALB Frame Size: 9 Flags: \0An album", but those "\0" bytes are not visible.

Your writer needs to not deal with just the frame type, frame length, and flags. It also has to deal with (for some frame types) one more byte which I quoted the documentation for above.

- tye        

  • Comment on Re^3: ID3 tag version 2.4.0 Pack and Unpack (text encoding byte)

Replies are listed 'Best First'.
Re^4: ID3 tag version 2.4.0 Pack and Unpack (text encoding byte)
by thanos1983 (Parson) on Sep 04, 2014 at 23:19 UTC

    Hello again tye,

    I understand what you mean by the null terminating character on the strings. But on the flag how can I remove it? I assume you mean the part that I apply if ($flags == 0). I assume, I tried to apply chop right after the part ( $flags ) = unpack ( "h" , $lines ); I apply chop($flags);. On the writing part I still have the problem. Unless if I miss understood.

    I know that I am missing somewhere one byte and I can not understand what is my error.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
      I understand what you mean by the null terminating character on the strings.

      That is unfortunate as I have not been saying anything about null terminating characters. I have been talking about a single byte that is not part of the strings and is not terminating but goes right before each string. And it doesn't have to be a "null". It can be "\0", "\01", "\02", or "\03".

      Please go re-read my first post once you have thoroughly dismissed from your mind the idea that I'm talking about the "\0" bytes that terminate string values. Pay special attention to the part where I quote part of the spec you linked to. Then go find that part of the spec and read more there.

      - tye        

        Hello tye,

        Ok I think I finally understood what you mean. In this case what else can I do, since I applied poch($flags) right after the ( $flags ) = unpack ( "h" , $lines );.

        Unfortunately there was no change on my problem. I an still getting one less character at the beginning of the string.

        Seeking for Perl wisdom...on the process of learning...not there...yet!