[Freeipa-devel] [PATCH 536] ipapython: remove default_encoding_utf8

Jan Cholasta jcholast at redhat.com
Tue Jan 5 13:42:26 UTC 2016


On 5.1.2016 11:54, Alexander Bokovoy wrote:
> On Tue, 05 Jan 2016, Tomas Babej wrote:
>>
>>
>> On 01/05/2016 08:54 AM, Jan Cholasta wrote:
>>> Hi,
>>>
>>> the attached patch replaces the default_encoding_utf8 binary module with
>>> 2 lines of equivalent Python code.
>>>
>>> Honza
>>>
>>>
>>>
>>
>> This looks fine to me, however, I wonder, why this approach was ever
>> taken? The sys.setdefaultencoding is available in all versions of Python
>> ever supported by FreeIPA.
>>
>> Is it possible we're missing something here? Or was this option simply
>> overlooked?
> There is more history to it and it is mostly ugly:
> https://bugzilla.redhat.com/show_bug.cgi?id=243541

What is actually ugly is badly written code which assumes a specific 
encoding anywhere instead of using an encoding appropriate in the given 
context. Rather than working around it using hacks such as changing the 
default encoding, the preferrable solution should be to fix the badly 
written code itself (which is not always easy, as is the case with IPA).

-- 
Jan Cholasta




More information about the Freeipa-devel mailing list