> On 07 Mar 2018, at 23:57, Junio C Hamano <gits...@pobox.com> wrote:
> Lars Schneider <larsxschnei...@gmail.com> writes:
>> At this point I thought it would make sense to make the advised
>> encoding name uppercase in both situations. OK with you?
> In the endgame, if upcased and properly dashed form is always used,
> that would be good (if we are enforcing the policy, which I am not
> onboard 100% but it's your code and I do not care too strongly about
> it). I do not see much point in an interim step that only upcases
> without doing the dash insertion.
I would like to advise the dashed form as this seems to be the
canonical form and it avoids cross platform issues. My macOS
iconv does not support the form without dashes.
Would this approach work for you?
const char *advise_msg = _(
"The file '%s' contains a byte order "
"mark (BOM). Please use UTF-%s as "
const char *stripped;
char *upper = xstrdup_toupper(enc);
upper[strlen(upper)-2] = '\0';
skip_prefix(upper, "UTF-", &stripped) ||
skip_prefix(stripped, "UTF", &stripped);
advise(advise_msg, path, stripped);