Thread (1 message) 1 message, 1 author, 2016-06-15

Re: "add -p" + filenames with UTF-8 multibyte characters = "No changes"

From: Teemu Likonen <hidden>
Date: 2016-06-15 22:46:12

On 2009-02-15 22:36 (-0500), Jeff King wrote:
I am not opposed to setting this as a default, but I think there may
be some encoding issues to be dealt with. At the very least,
format-patch generates messages without a content-type header. E.g.,:
But what is the right encoding to specify? We can guess that it is
whatever the commit message is in (defaulting to utf-8). It is by no
means correct, but it would probably work pretty well in practice.
I have a small script which adds/rewrites MIME headers. It defaults to
UTF-8/8bit:

    #!/bin/sh

    charset="${1:-UTF-8}"
    encoding="${2:-8bit}"

    formail -I "MIME-Version: 1.0" \
            -I "Content-Type: text/plain; charset=$charset" \
            -I "Content-Transfer-Encoding: $encoding" \
            -s

I have used the script this way:

    git format-patch --stdout [...] | add-mime-headers | \
        formail -s sh -c 'cat >$FILENO.patch'

It may be difficult and unreliable to try to detect the encoding of file
content so maybe "git format-patch" could be taught an option like
"--charset=<charset>". (And perhaps also a configuration variable.) That
would just write MIME headers (charset) as the user wishes.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help