Commit c159d0ba authored by Simon McVittie's avatar Simon McVittie Committed by Guido Günther

pq export: Write out patches as UTF-8 if necessary

Due to behaviour changes in Python, git-buildpackage would previously
write the commit message in the base64 Content-Transfer-Encoding, which
is not very readable. Now it uses 8bit.

Based on a patch from Carlos Maddela.

Closes: #883541
parent 29eafbcf
......@@ -25,6 +25,7 @@ import time
from email.message import Message
from email.header import Header
from email.charset import Charset, QP
from email.policy import Compat32
from gbp.git import GitRepositoryError
from gbp.git.modifier import GitModifier, GitTz
......@@ -177,7 +178,8 @@ def write_patch_file(filename, commit_info, diff):
except (UnicodeEncodeError):
msg.set_payload(body, charset)
patch.write(msg.as_string(unixfrom=False, maxheaderlen=77).encode('utf-8'))
policy = Compat32(max_line_length=77)
patch.write(msg.as_bytes(unixfrom=False, policy=policy))
# Write diff
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment