[Freeipa-devel] [PATCH] 0048 Decode HTTP reason phrase as iso-8859-1

Fraser Tweedale ftweedal at redhat.com
Wed Jan 6 04:26:31 UTC 2016


Happy new year, all.

The attached patch fixes a unicode decode error triggered in some
locales, which causes failure of installation (and probably other
oprations, if locale is changed under an existing server).

https://fedorahosted.org/freeipa/ticket/5578

Cheers,
Fraser
-------------- next part --------------
From 9fb59b95553d3f02aa401142a87723e5d0fb2b8a Mon Sep 17 00:00:00 2001
From: Fraser Tweedale <ftweedal at redhat.com>
Date: Wed, 6 Jan 2016 14:50:42 +1100
Subject: [PATCH] Decode HTTP reason phrase as iso-8859-1

The HTTP reason phrase sent by Dogtag is encoded in iso-8859-1; use
this charset instead of utf8 when decoding it to avoid decoding
errors when characters > 127 appear.

Fixes: https://fedorahosted.org/freeipa/ticket/5578
---
 ipapython/dogtag.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipapython/dogtag.py b/ipapython/dogtag.py
index 010e49652687680444d18e2e8f784fb6167a0df5..c99847013c70c7e82796a99234c1e684f32ddfac 100644
--- a/ipapython/dogtag.py
+++ b/ipapython/dogtag.py
@@ -219,7 +219,7 @@ def _httplib_request(
         res = conn.getresponse()
 
         http_status = res.status
-        http_reason_phrase = unicode(res.reason, 'utf-8')
+        http_reason_phrase = unicode(res.reason, 'iso-8859-1')
         http_headers = res.msg.dict
         http_body = res.read()
         conn.close()
-- 
2.5.0



More information about the Freeipa-devel mailing list