Open Ferry-200 opened 2 months ago
Hello!
Your file has items that are not UTF-8 encoded. What is your local character encoding? If Windows is able to read it, that means the file is using your system encoding.
UTF-16. And the file's tags are UTF-16 LE encoded.
Hm. It's unfortunate that RIFF doesn't specify a text encoding. We would be able to somewhat reliably detect UTF-16 LE, but there's no BOM either. The only way for us to know ahead of time how to decode the text would be using GetACP() from Windows. Don't know how I feel about having platform-specific code in Lofty, though.
Maybe we can simply set the way to decode text when reading riff info. Obviously it is not a good way to fix it though.
And this is the way how the Taglib support it. StringHandler
StringHandler
Detailed Description
An abstraction for the string to data encoding in Info tags.
RIFF INFO tag has no clear definitions about character encodings. In practice, local encoding of each system is largely used and UTF-8 is popular too.
Here is an option to read and write tags in your preferred encoding by subclassing this class, reimplementing parse() and render() and setting your reimplementation as the default with Info::Tag::setStringHandler().
That would also work. Gonna have to think about this one. For now I'd just recommend changing the encoding of your files to UTF-8, that's what most libraries (outside of TagLib) will exclusively support.
Reproducer
I tried this code:
The lofty version is "0.18.2"![image](https://github.com/Serial-ATA/lofty-rs/assets/98510207/9b3a1258-0619-4fbf-8234-98c4dd2d0ea7)
Summary
There is an error "Wav: Failed to read RIFF INFO item value"
The Windows Properties page can read the tags in it. I can also play it on Windows Media Player.
Can anyone provide some information about this? Thanks.
Expected behavior
Read tag correctly.
Assets
大哉乾元(洛天依人声版)_MMM.wav