Closed
Description
Reproducer
I tried this code:
use std::path::Path;
use lofty::config::{ParseOptions, ParsingMode};
use lofty::file::{AudioFile, TaggedFileExt};
use lofty::probe::Probe;
use lofty::tag::Accessor;
fn main() {
// the error seems to occur with strict or relaxed parsing mode
let parsing_options = ParseOptions::new().parsing_mode(ParsingMode::Relaxed);
let path = Path::new("sample.mp3");
let file = Probe::open(&path)
.expect("can't probe")
.options(parsing_options)
.read()
.expect("can't read");
let tag = file.primary_tag().expect("no tag");
let properties = file.properties();
println!("{:?}", tag.artist());
println!("{:?}", tag.year());
}
Summary
This results in this panic:
thread 'main' panicked at src/main.rs:16:10:
can't read: TextDecode("UTF-16 string has an odd length")
Expected behavior
ffprobe and id3info both seem to be able to read this sample file ok. Are they just falling back to some kind of best-effort conversion for badly encoded UTF-16 strings perhaps?