You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a music file I can’t modify, which contains SHIFT_JIS-encoded tags (it’s a Wave file containing INAM=東方紅魔郷).
What would be your preferred way to handle this issue? Asking the user to provide the encoding, guessing it, or even to ignore any non-UTF-8 tag and act as if it wasn’t present?
I personally don’t need the tags, but other users might.
Here is the full traceback:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:Utf8Error{valid_up_to:0,error_len:Some(1)}', /home/linkmauve/.cargo/registry/src/github.com-1ecc6299db9ec823/ears-0.7.0/src/sndfile.rs:383:17
stack backtrace:
r 0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:881: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:662: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:773: <std::sys_common::backtrace::_print::DisplayBacktraceas core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:594: core::fmt::write
at src/libcore/fmt/mod.rs:10525: std::io::Write::write_fmt
at src/libstd/io/mod.rs:14266: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:627: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:498: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:2049: std::panicking::default_hook
at src/libstd/panicking.rs:22410: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:47211: rust_begin_unwind
at src/libstd/panicking.rs:38012: core::panicking::panic_fmt
at src/libcore/panicking.rs:8513: core::option::expect_none_failed
at src/libcore/option.rs:119914: core::result::Result<T,E>::unwrap
at /rustc/c2d141df59703393c0c683abc259f9a8c3be041a/src/libcore/result.rs:96315: ears::sndfile::SndFile::get_string
at /home/linkmauve/.cargo/registry/src/github.com-1ecc6299db9ec823/ears-0.7.0/src/sndfile.rs:38316: ears::audio_tags::get_sound_tags
at /home/linkmauve/.cargo/registry/src/github.com-1ecc6299db9ec823/ears-0.7.0/src/audio_tags.rs:8417: ears::music::Music::new
at /home/linkmauve/.cargo/registry/src/github.com-1ecc6299db9ec823/ears-0.7.0/src/music.rs:13218: menu::main
at examples/menu.rs:11919: std::rt::lang_start::{{closure}}
at /rustc/c2d141df59703393c0c683abc259f9a8c3be041a/src/libstd/rt.rs:6720: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:5221: std::panicking::try::do_call
at src/libstd/panicking.rs:30522: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:8623: std::panicking::try
at src/libstd/panicking.rs:28124: std::panic::catch_unwind
at src/libstd/panic.rs:39425: std::rt::lang_start_internal
at src/libstd/rt.rs:5126: std::rt::lang_start
at /rustc/c2d141df59703393c0c683abc259f9a8c3be041a/src/libstd/rt.rs:6727: main
28: __libc_start_main
29: _start
note:Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The text was updated successfully, but these errors were encountered:
I think for now treating non-UTF-8 tags as empty is fine, and a lot better than a panic. If someone really needs to read non-UTF-8 tags then we can possibly add something more elaborate in the future.
This prevents a panic when opening a file which contains non-UTF-8 tags,
but still prevents users from accessing them.
In the future it might be useful to provide an API giving the raw bytes
if the user wants to try guessing it, or maybe even add an (optional)
encoding crate dependency for formats which declare their encoding.
Fixesnickbrowne#6.
I have a music file I can’t modify, which contains SHIFT_JIS-encoded tags (it’s a Wave file containing INAM=東方紅魔郷).
What would be your preferred way to handle this issue? Asking the user to provide the encoding, guessing it, or even to ignore any non-UTF-8 tag and act as if it wasn’t present?
I personally don’t need the tags, but other users might.
Here is the full traceback:
The text was updated successfully, but these errors were encountered: