[Vorbis] newlines in vorbis comments
Beni Cherniavsky
cben at users.sf.net
Sat Sep 18 14:17:48 PDT 2004
Haxe wrote:
> I personally don't use this. But it would feel safer if I could handle
> these tags with vobiscomment without risking data loss.
>
Round-tripping without data loss is not the only concern. Since we are
mainly talking about calling vorbiscomment from scripts, it is very
desirable to quote newlines in a way that contains no newlines, so that
any comment fits on one line. Then one could process comments safely
with tools like grep.
> The problem with vorbiscomment is the following.
> The documentation says:
>
>>-c commentfile
>>Take comments from a file. The file is the same format as is output by
>>the -l option;
>
> But this is simply not true. The -l option can indeed generate output
> that can't be re-imported by the -c option. This is exactly the case
> when any exported comment contains a newline. This is because, whereas
> the internal representation of vorbistags may be binary-safe, the
> format of the commentfile is NOT binary-safe.
>
The help string does say at the end that even --raw, -R "is not
sufficient for general round-tripping of comments in all cases."
> Therefore, I suggest to introduce two new options to vorbiscomment:
> -e = export tags to a binary-safe format
> -i = import tags binary-safe, expected format is like the output of -e
>
I don't see the need for two new options, one option combined with each
mode now ([-l]/-a/-w) will suffice. In fact, piggy-backing -R would
probably do but the behavior-name mismatch would be too bad.
I wrote once a patch that did this. It did too much (offereing several
different quoting styles) which is perhpas the reson it wasn't accepted.
I could pick it up and submit a fresh version. Any chance it will be
included?
I think the backslash quoting style is best: \n, \r, \0 and \\
supported. One newline style (the unix one obviously ;-)) should be
strongly recommended by the spec but vorbiscomment should round-trip
anything. It should probably normalize newlines in non-raw non-quoting
more (the default) so that they show correctly in e.g. the windows
console window. It's good to escape \0 because most programs choke on
it, so it can break many processing scripts even if vorbiscomment is
otherwise unambiguos. Sounds sensible?
--
Beni Cherniavsky <cben at users.sf.net>
Note: I can only read email on week-ends...
More information about the Vorbis
mailing list