Bug#495272: deb822 cannot handle unicode fields

Jonny Lamb jonnylamb at jonnylamb.com
Fri Aug 15 19:55:55 UTC 2008


Package: python-debian
Version: 0.1.11
Severity: important
Tags: patch

Hi,

When executing the "dump" method when there is unicode in one of the
fields in the rfc822 file a UnicodeDecodeError is raised. An example of
this and a traceback can be seen in [0].

This can easily be reproduced by getting a dsc file and throwing some
awkward characters in the Maintainer field, then executing:

 >>> from debian_bundle import deb822
 >>> a = deb822.Dsc(file(filename))
 >>> a.dump

I attach a patch (you can easily apply with git-am(1)) to try and fix
this problem.

Regards,

0. http://debexpo.workaround.org/trac/ticket/68

-- 
Jonny Lamb, UK                                   jonnylamb at jonnylamb.com
http://jonnylamb.com                                     GPG: 0x2E039402
-------------- next part --------------
From ad57ff6d56074f7c0e35efadd403601b312f5c8f Mon Sep 17 00:00:00 2001
From: Jonny Lamb <jonnylamb at jonnylamb.com>
Date: Fri, 15 Aug 2008 20:14:31 +0100
Subject: [PATCH] Added utf-8 encoding header to deb822.

Calling methods on a Deb822 object (such as dump) when there are unicode
characters in fields raises a UnicodeDecodeError, because the file's
encoding is the system default: ascii.

Signed-off-by: Jonny Lamb <jonnylamb at jonnylamb.com>
---
 debian_bundle/deb822.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/debian_bundle/deb822.py b/debian_bundle/deb822.py
index fbc96eb..1cffd4a 100644
--- a/debian_bundle/deb822.py
+++ b/debian_bundle/deb822.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # vim: fileencoding=utf-8
 #
 # A python interface for various rfc822-like formatted files used by Debian
-- 
1.5.6.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-python-debian-maint/attachments/20080815/70f5ba49/attachment.pgp 


More information about the pkg-python-debian-maint mailing list