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

The slash (/) characters in tags are not correctly parsed #103

Open
tranxuanthang opened this issue Oct 25, 2022 · 2 comments
Open

The slash (/) characters in tags are not correctly parsed #103

tranxuanthang opened this issue Oct 25, 2022 · 2 comments

Comments

@tranxuanthang
Copy link

tranxuanthang commented Oct 25, 2022

Looks like slash characters in tags are not parsed correctly by rust-id3 and are converted to null terminator character.

Some examples are:

  • (artist name) Alan Walker, Au/Ra, Tomine Harket => "Alan Walker, Au\0Ra, Tomine Harket"
  • (artist name) Derek Duke/Russell Brower => "Derek Duke\0Russell Brower"
  • (album & track name) Misty Mountains (In Dwarvish/Khuzdul) => "Misty Mountains (In Dwarvish\0Khuzdul)"

EDIT: Update example file. I'm not quite sure yet but it seems that the issue only happens in ID3 v2.3 version.

let mut tag = id3::Tag::new();
tag.add_frame(id3::Frame::text("TPE1", "Derek Duke/Russell Brower"));
tag.write_to_path("test.id3", id3::Version::Id3v23).unwrap();
let tag = id3::Tag::read_from_path("test.id3").unwrap();
println!("{:?}", tag.artist()); // Some("Derek Duke\0Russell Brower")

test.zip

@tranxuanthang
Copy link
Author

tranxuanthang commented Oct 27, 2022

After seeing these:

I understand the issue better now. But still I think assuming the slash / character as separator for multiple entries for ID3 v2.2 or v2.3 might end up messing with a few artist names. One of these cases is my first example, calling tag.artists() will get you Some(["Alan Walker, Au", "Ra, Tomine Harket"]).

At least, I think the null/slash substitute definitely should not apply for all text fields, for example album name and track name. And tag.artist() should return the expected result, without null terminator character.

@polyfloyd
Copy link
Owner

ID3 has support for split values in text frames. In v2.2 and v2.3 the separator is a slash while in v2.4 it is a null byte.

I intended the library to have a uniform ID3v2.4 interface, so everything that it reads is normalized to use null bytes. But I must admit that this leaves much to desire...

Splitting happens at a very low level, just after decoding at src/stream/frame/content.rs:449

It might be worth considering making the split functions of TagLike version aware so at least the underlying content remains untouched unless desired

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

No branches or pull requests

2 participants