Skip to main content

Module commit_encoding

Module commit_encoding 

Source
Expand description

Git commit encoding labels (encoding header, i18n.commitEncoding) mapped to codecs.

Git’s ISO-8859-1 is strict Latin-1; encoding_rs maps that label to Windows-1252, so we handle Latin-1 separately.

Functions§

decode_bytes
Decode bytes using Git’s encoding name, or lossy UTF-8 if unknown.
encode_header_text
Encode a single header field (author/committer line) without adding a trailing newline.
encode_unicode
Encode unicode for storage in a commit message body using Git’s encoding name.
ensure_body_trailing_newline
Git stores the commit message body with a trailing newline when non-empty.
reencode_utf8_to_label
Re-encode unicode from UTF-8 into output_label, or None if unsupported.
resolve
Resolve an encoding label the way Git uses it in config and commit objects.