Re: metaflac --no-utf8-convert complains about UTF

Brian Willoughby <[email protected]> Sat, 6 Dec 2014 01:28:55 -0800
Newsgroups gmane.comp.audio.compression.flac.user
Message-ID <[email protected]>
On Dec 6, 2014, at 12:54 AM, Jan Stary <[email protected]> wrote:
> On Dec 05 20:16:47, [email protected] wrote:
>> This is 1.3.1 on OpenBSD/amd64.
>> The --no-utf8-convert option of metaflac(1) does not work for me:
>> =

>> $ metaflac --no-utf8-convert --set-tag=3D"Artist=3D=AEou=BEl=ED=E8ek" al=
adin.flac
>> aladin.flac: ERROR: tag value for 'Artist' is not valid UTF-8
>> (You probably can't see the Czech letters properly in my mail,
>> but that's beside the point.)
>> =

>> Indeed, it is not valid UTF8 (it's LATIN2), but isn't metaflac
>> supposed to just write it as specified, with this option?
> =

> The problem seems to be in
> src/metaflac/operations_shorthand_vorbiscomment.c
> in the set_vc_field() function.
> =

> It does check whether utf conversion is required,
> =

>  /* move 'data' into 'converted', converting to UTF-8 if necessary */
>  if(raw) {
> 	converted =3D data;
>  }
> 					                  }
> but later checks that FLAC__format_vorbiscomment_entry_is_legal()
> whether or not we are utf converting; and this function, defined
> in ./src/libFLAC/format.c, ultimately calls for utf8len_(s) no matter wha=
t.
> So my LATIN2 text fails to be legal, because it's not legal UTF
> -- which, indeed, it isn't.

Looks like you found the problem. One piece of code is doing the right thin=
g, another piece of code is ignoring the option.

By the way, I've never used FLAC inside Ogg Vorbis. Instead, I use pure FLA=
C format files. Is there any difference between the way this option works o=
n a straight FLAC file versus how it works on FLAC data in an Ogg Vorbis co=
ntainer?

Brian