[BUG] Saving attachments containing UTF-8 chars

Subject: [BUG] Saving attachments containing UTF-8 chars

Date: Mon, 29 Oct 2012 14:30:17 +0100

To: notmuch@notmuchmail.org


From: Michael Stapelberg


attached you can find a message which seems to trigger a bug somewhere
in my notmuch setup. The message has been sent to me and includes a
patchfile, which, when saved using the "w" key in notmuch-emacs, cannot
be applied.

When using munpack(1) on the raw mail file (I’ve attached rawmail.gz
just to be sure that the message doesn’t get mangled in some way), the
unpacked attachment can be attached just fine.

When diff'ing both files, I see that munpack correctly stores the file,
including the problematic UTF-8 apostrophe:
00000200  67 3b 20 64 69 64 6e e2  80 99 74 20 72 65 61 64  |g; didn...t read|

However, the version of the file saved with notmuch contains:
00000200  67 3b 20 64 69 64 6e 19  74 20 72 65 61 64 22 20  |g; didn.t read" |

If there is anything I can do to help debugging this (or if there is a
known fix), please let me know.

On 2012-10-25 04:44, Michael Stapelberg wrote:
> Hi Conley,
> Conley Moorhous <conleymoorhous@gmail.com> writes:
>> Sorry, I accidentally used the master branch. I've attached the proper
>> patch, matched against the next branch!
> Im sorry to bother you again about this, but I still cannot apply the
> patch you sent me on the "next" branch:
> midna /tmp $ git clone -b next git://code.i3wm.org/i3
> Cloning into 'i3'...
> remote: Counting objects: 20314, done.
> remote: Compressing objects: 100% (4651/4651), done.
> remote: Total 20314 (delta 15312), reused 20314 (delta 15312)
> Receiving objects: 100% (20314/20314), 4.98 MiB | 418 KiB/s, done.
> Resolving deltas: 100% (15312/15312), done.
> midna /tmp $ cd i3    
> midna /tmp/i3 next $ git am /tmp/fix_alt.patch
> Applying: docs/userguide: s/alt/Alt/
> error: patch failed: docs/userguide:12
> error: docs/userguide: patch does not apply
> Patch failed at 0001 docs/userguide: s/alt/Alt/
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
> I then tried to make the changes you did on my own and generate a patch
> file using git format-patch HEAD^ and it looks very much like yours,
> except that it doesnt have broken UTF-8 in the first context line.
> Im not too sure where the problem lies here (that is, whether its your
> system, git version, locale setup, mail client), but you might want to
> investigate and re-send the patch. If you cant figure it out, I can
> also do the changes for you and commit it, though it seems desirable to
> me to fix such issues once and for all.
Wow, turns out I'm dumb :( It was Thunderbird, which, for some reason,
does not default to UTF-8. It /might/ work now, but knowing me, I'll
have done something else wrong (I tried applying it locally and it
worked)! I'm putting you through all this work for three measly words, ha!

I'll make up for it eventually, I hope. I'll submit a big ol' helpful patch.
rawmail.gz (application/octet-stream)