Skip to content

Commit d17f549

Browse files
committed
Merge branch 'rs/convert-fix-utf-without-dash'
The code to skip "UTF" and "UTF-" prefix, when computing an advice message, did not work correctly when the prefix was "UTF", which has been fixed. * rs/convert-fix-utf-without-dash: convert: fix handling of dashless UTF prefix in validate_encoding()
2 parents 82c80f9 + b181676 commit d17f549

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

convert.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ static int validate_encoding(const char *path, const char *enc,
290290
const char *stripped = NULL;
291291
char *upper = xstrdup_toupper(enc);
292292
upper[strlen(upper)-2] = '\0';
293-
if (!skip_prefix(upper, "UTF-", &stripped))
294-
skip_prefix(stripped, "UTF", &stripped);
293+
if (skip_prefix(upper, "UTF", &stripped))
294+
skip_prefix(stripped, "-", &stripped);
295295
advise(advise_msg, path, stripped);
296296
free(upper);
297297
if (die_on_error)
@@ -310,8 +310,8 @@ static int validate_encoding(const char *path, const char *enc,
310310
"working-tree-encoding.");
311311
const char *stripped = NULL;
312312
char *upper = xstrdup_toupper(enc);
313-
if (!skip_prefix(upper, "UTF-", &stripped))
314-
skip_prefix(stripped, "UTF", &stripped);
313+
if (skip_prefix(upper, "UTF", &stripped))
314+
skip_prefix(stripped, "-", &stripped);
315315
advise(advise_msg, path, stripped, stripped);
316316
free(upper);
317317
if (die_on_error)

0 commit comments

Comments
 (0)