# \[X\] 0-termination in text frames

**URL:** https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596
**Category:** No Bugs
**Created:** [March 11, 2007, 2:57pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596 "2007-03-11T14:57:57Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![patheticpat](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/87869e/32.png) [@patheticpat](https://community.mp3tag.de/u/patheticpat)
#### Post date: [March 11, 2007, 2:57pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/1 "2007-03-11T14:57:57Z")

</div>

I discovered the following bug in mp3tag: It appears that mp3tag writes 0-terminated strings in id3v2 text frames where according to the specs there should be no 0-termination. This problem remains mainly unnoticed, but iTunes 7.1 chokes on the extra 0 in UTF-8 encoded v2.4 tags.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [March 11, 2007, 3:07pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/2 "2007-03-11T15:07:28Z")

</div>

iTunes itself writes 0-termination on every frame!  
And it's no problem for iTunes on other encodings, just utf-8 is a problem for it. Only Apple knows why. It's an iTunes bug!  
iTunes also has more ID3v2.4 bugs that can make it problematic to use ID3v2.4 with itunes.

---

<div class="post-metadata">

### Author: ![patheticpat](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/87869e/32.png) [@patheticpat](https://community.mp3tag.de/u/patheticpat)
#### Post date: [March 11, 2007, 3:43pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/3 "2007-03-11T15:43:18Z")

</div>

You are right, iTunes writes the 0-termination, but it doesn't write UTF-8. So, only Apple knows why it does that, but why does Mp3tag do it? I mean, it is still against the specs.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [March 31, 2007, 10:44am UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/4 "2007-03-31T10:44:45Z")

</div>

I've changed the ID3v2 writer with the current [Development Build](http://developer.mp3tag.de), so that frames are written without 0-termination.

It wasn't a bug, but it's probably more compatible without the 0-termination.

Kind regards,  
Florian

---

<div class="post-metadata">

### Author: ![klaasklever](https://community.mp3tag.de/user_avatar/community.mp3tag.de/klaasklever/32/87_2.png) [@klaasklever](https://community.mp3tag.de/u/klaasklever)
#### Post date: [March 31, 2007, 9:38pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/5 "2007-03-31T21:38:16Z")

</div>

So, according to the ID3 specs, is it optional or forbidden  
to write terminated text strings ? I was under the impression that  
it is optional (i.e. it is _not_ against the specs to do so) ?

And besides, while increasing iTunes "compatibility", are there  
any risks that this change might lead to compatibility issues on  
other fronts (with other software / other devices) ?

---

<div class="post-metadata">

### Author: ![Radagast](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9dc877/32.png) [@Radagast](https://community.mp3tag.de/u/Radagast)
#### Post date: [April 3, 2007, 10:18am UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/6 "2007-04-03T10:18:49Z")

</div>

Hello.

According to the specs of Ver. 2.4 there has to be such a termination.

> [@](#):
>
> Frames that allow different types of text encoding contains a text  
> encoding description byte. Possible encodings:
> 
> ```
> $00 ISO-8859-1 [ISO-8859-1]. Terminated with $00.
> $01 UTF-16 [UTF-16] encoded Unicode [UNICODE] with BOM. All
> strings in the same frame SHALL have the same byteorder.
> Terminated with $00 00.
> $02 UTF-16BE [UTF-16] encoded Unicode [UNICODE] without BOM.
> Terminated with $00 00.
> $03 UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with $00.
> 
> ```
> 
> Strings dependent on encoding are represented in frame descriptions  
> as , or if newlines are allowed. Any empty strings of  
> type $01 which are NULL-terminated may have the Unicode BOM followed  
> by a Unicode NULL ($FF FE 00 00 or $FE FF 00 00).

See also [http://www.id3.org/id3v2.4.0-structure](http://www.id3.org/id3v2.4.0-structure) .

Regards,  
Radagast

---

<div class="post-metadata">

### Author: ![patheticpat](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/87869e/32.png) [@patheticpat](https://community.mp3tag.de/u/patheticpat)
#### Post date: [April 3, 2007, 10:36am UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/7 "2007-04-03T10:36:45Z")

</div>

> [@Radagast](#):
>
> Hello.
> 
> According to the specs of Ver. 2.4 there has to be such a termination.  
> See also [http://www.id3.org/id3v2.4.0-structure](http://www.id3.org/id3v2.4.0-structure) .
> 
> Regards,  
> Radagast

Well, the specs isn't very clear regarding the termination. The termination sequences for the different character encodings are relevant for all frames holding several strings, they are separated by the termination sequences (noted as $00 (00) in the specs). But I really don't see any point in terminating single strings. So, I don't know... 😛

---

<div class="post-metadata">

### Author: ![klaasklever](https://community.mp3tag.de/user_avatar/community.mp3tag.de/klaasklever/32/87_2.png) [@klaasklever](https://community.mp3tag.de/u/klaasklever)
#### Post date: [April 4, 2007, 10:21pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/8 "2007-04-04T22:21:33Z")

</div>

Well, I am confused too. From my reading it seems optional, but  
the way the spec is written indicates that termination might be the preferred way.

If it is not clear from the specification, I think Mp3tag should do what is common practice  
and what most other tag writers do and have done for years. If, for example Winamp, Foobar,  
Windows Media Player, and Taglib (Linux) all use termination (I don't know if they do) that  
would be what I mean by "common practice".

I think it would not be a good Idea to change the behavior (from termination to no termination)  
more or less just because of a bug in iTunes, when it is (I don't know if it is) common practice  
to terminate strings. _Maybe this would cause problems with some other programs, who knows ?_

Anyway, I'm not enough into the specifications and intricacies of ID3v2 to know what's best,  
but I just wanted to provide some "food for thought" that _maybe_ it could be not a good idea to  
change something that fundamental just because of iTunes...

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 5, 2007, 7:40am UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/9 "2007-04-05T07:40:45Z")

</div>

To me it's pretty clear that this additional termination is wrong, but is also does not do much harm.

The big majority of programs use no termination.  
The ID3v2 reference library id3lib doesn't do it.

When you read also the frame definitions of the ID3v2 standard [http://www.id3.org/id3v2.4.0-frames](http://www.id3.org/id3v2.4.0-frames) and not only the chapter that Radagast showed, you should understand that this chapter only shows how you have to terminate a string but not when.  
Compare for example chapter 4.2 with 4.2.6 from id3v2.4.0-frames

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 5, 2007, 4:48pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/10 "2007-04-05T16:48:43Z")

</div>

In addition to that, ID3v2.4 uses the terminating 0 to separate multiple strings in one frame. So a terminating 0 after the last string in a text frame could be interpreted as an additional string with zero length. Sounds a little bit hypothetical, but it could be interpreted like that.

Kind regards,  
Florian

---

<div class="post-metadata">

### Author: ![Prodoc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@Prodoc](https://community.mp3tag.de/u/Prodoc)
#### Post date: [May 1, 2007, 8:31am UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/11 "2007-05-01T08:31:21Z")

</div>

Personally I think the section Radagast referred to is clear enough.

> [@](#):
>
> $03 UTF-8 [UTF-8] encoded Unicode [UNICODE]. **Terminated with $00**.

However, since some still find this disputable, would it be an idea to have the option to enable 0 terminating? Right now I'm tempted to stick to the latest beta which still had 0 termination but this would leave me with possible bugs and the lack of new features like TAK support.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [May 1, 2007, 8:35am UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/12 "2007-05-01T08:35:03Z")

</div>

No, this section only refers to strings which need to be terminated (which are referenced as 'terminated string' in the [ID3v2.4 spec](http://id3.org/id3v2.4.0-frames)).

Can you point me to the application which requires the terminating 0 after each string?

Kind regards,  
Florian

---

<div class="post-metadata">

### Author: ![jesus2099](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jesus2099/32/177_2.png) [@jesus2099](https://community.mp3tag.de/u/jesus2099)
#### Post date: [May 11, 2007, 4:30pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/13 "2007-05-11T16:30:30Z")

</div>

Hello !!

I have a problem since version 2.38.  
My walkman now cuts the last character of my song titles and artist names ! ☹  
I had a look in the release notes and saw this probable cause :

```
[2007-04-29] REL: VERSION 2.38 (for Windows 2000/XP/2003/Vista)
[2007-03-17] CHG: ID3v2 text frames are written without terminating 0 now.

```

Then I found this thread, hopefully !  
Previously, my walkman ([A-Data MF1](http://shamo.fr/jesus2099/blog/2006/03/data-my-joy-mf1-1-go-noirorange.html)), was cutting the last characters of **ID3v2.4** (UTF-8) tags only.  
When I used **ID3v2.3** (UTF-16) tags, it was OK and displayed the full field contents.  
Since mp3tag v2.38, the last character is cut, whatever the ID3v2 version…

It would be nice (at least for me) that I would be able to put this "_0_" back at the end of fields ![:rolleyes:](https://community.mp3tag.de/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif ":rolleyes:")  
Who cares about iTunes anyway? ![:huh:](https://community.mp3tag.de/uploads/default/original/1X/f15ee73c0fd9ec3b0db7481f0558638f8ee224ce.gif ":huh:")

Tristan

---

<div class="post-metadata">

### Author: ![jesus2099](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jesus2099/32/177_2.png) [@jesus2099](https://community.mp3tag.de/u/jesus2099)
#### Post date: [June 9, 2007, 1:13pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/14 "2007-06-09T13:13:04Z")

</div>

…so it's a dead end?

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [June 9, 2007, 6:13pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/15 "2007-06-09T18:13:54Z")

</div>

Yes, I won't change the behaviour again and I don't think that it's good to add options for all this weird software and hardware out there.

Sorry for that!

Kind regards,  
Florian

---

<div class="post-metadata">

### Author: ![jesus2099](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jesus2099/32/177_2.png) [@jesus2099](https://community.mp3tag.de/u/jesus2099)
#### Post date: [June 10, 2007, 11:03am UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/16 "2007-06-10T11:03:34Z")

</div>

Well, if IT IS THE STANDARD, it's OK with me…  
I'll try to make them write a new firmware.

---

<div class="post-metadata">

### Author: ![Kreator](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kreator/32/199_2.png) [@Kreator](https://community.mp3tag.de/u/Kreator)
#### Post date: [September 16, 2007, 10:22am UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/17 "2007-09-16T10:22:41Z")

</div>

Hello.

To my mind, having a superfluous #0 makes less harm (if it does), than not having 0-termination at all. Anyway, yes, you're right, it's not needed, but seems that many players (soft and hard) are confused. Don't know, if my one will show me correct values, but I agree with this change.

Thanks for mp3tag.  
Regards, Alex.

---

<div class="post-metadata">

### Author: ![jesus2099](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jesus2099/32/177_2.png) [@jesus2099](https://community.mp3tag.de/u/jesus2099)
#### Post date: [September 18, 2007, 1:53pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/18 "2007-09-18T13:53:26Z")

</div>

I wonder what other people think…  
My walkman's manufacturer doesn't reply my request and has never issued any firmware update. ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")

Thank you for giving your opinion too Kreator.  
I'd like that zero back myself too. ![:huh:](https://community.mp3tag.de/uploads/default/original/1X/f15ee73c0fd9ec3b0db7481f0558638f8ee224ce.gif ":huh:")

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 28, 2018, 2:18pm UTC](https://community.mp3tag.de/t/x-0-termination-in-text-frames/4596/19 "2018-12-28T14:18:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
