MCPcopy Create free account
hub / github.com/git/git / convert_to_utf8

Function convert_to_utf8

mailinfo.c:455–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455static int convert_to_utf8(struct mailinfo *mi,
456 struct strbuf *line, const char *charset)
457{
458 char *out;
459 size_t out_len;
460
461 if (!mi->metainfo_charset || !charset || !*charset)
462 return 0;
463
464 if (same_encoding(mi->metainfo_charset, charset))
465 return 0;
466 out = reencode_string_len(line->buf, line->len,
467 mi->metainfo_charset, charset, &out_len);
468 if (!out) {
469 mi->input_error = -1;
470 return error("cannot convert from %s to %s",
471 charset, mi->metainfo_charset);
472 }
473 strbuf_attach(line, out, out_len, out_len + 1);
474 return 0;
475}
476
477static void decode_header(struct mailinfo *mi, struct strbuf *it)
478{

Callers 2

decode_headerFunction · 0.70
handle_commit_msgFunction · 0.70

Calls 4

same_encodingFunction · 0.85
errorFunction · 0.85
strbuf_attachFunction · 0.85
reencode_string_lenFunction · 0.70

Tested by

no test coverage detected