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

Wrong length zero bytes for UTF-8 encoding strings #3

Closed
edementiev opened this issue Jul 28, 2019 · 3 comments
Closed

Wrong length zero bytes for UTF-8 encoding strings #3

edementiev opened this issue Jul 28, 2019 · 3 comments

Comments

@edementiev
Copy link

Data+String.swift
in case when comment have encoding .utf8 and we looking for zero bytes end of string we must wait ONE zero byte not two

two zero bytes only for UTF16

// unicode strings are terminated by \0\0, while latin terminated by \0
your comment is wrong only utf16 strinds are termonated by \0\0

http://id3.org/id3v2.4.0-structure
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.
@HendX
Copy link
Contributor

HendX commented Jul 30, 2019

Do you know if this is for all versions, or just for 2.4? In 2.3, it just mentions "unicode" but doesn't differentiate between UTF-8 and UTF-16.

All numeric strings and URLs [URL] are always encoded as ISO-8859-1. Terminated strings are terminated with $00 if encoded with ISO-8859-1 and $00 00 if encoded as unicode.

http://id3.org/d3v2.3.0

@HendX
Copy link
Contributor

HendX commented Jul 31, 2019

I've just pushed an update which makes this change. Please let me know if this works better for you.

@edementiev
Copy link
Author

edementiev commented Aug 9, 2019

Yes, you are right about versions before 2.4
Your fix correctly working for me, thanks!

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