[Yum-devel] [PATCH] Stop the python encoding madness, with a big hammer of fire.

seth vidal skvidal at fedoraproject.org
Mon Mar 7 15:56:07 UTC 2011


On Mon, 2011-03-07 at 10:52 -0500, James Antill wrote:
> ---
>  yum/misc.py |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/yum/misc.py b/yum/misc.py
> index 8e81c34..305d4aa 100644
> --- a/yum/misc.py
> +++ b/yum/misc.py
> @@ -977,7 +977,8 @@ def getloginuid():
>  # ---------- i18n ----------
>  import locale
>  import sys
> -def setup_locale(override_codecs=True, override_time=False):
> +def setup_locale(override_codecs=True, override_time=False,
> +                 override_encoding=True):
>      # This test needs to be before locale.getpreferredencoding() as that
>      # does setlocale(LC_CTYPE, "")
>      try:
> @@ -995,6 +996,10 @@ def setup_locale(override_codecs=True, override_time=False):
>          import codecs
>          sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
>          sys.stdout.errors = 'replace'
> +    if override_encoding:
> +        # Dear python, please let your 'ascii' default die in a fire. kthxbye
> +        reload(sys)
> +        sys.setdefaultencoding('utf-8')
>  
> 
>  def get_my_lang_code():


So, you're just interested in seeing what ways this breaks things?

How about we apply this to rawhide yum first, just for s&g and see what
goes KABOOM before applying upstream?

-sv






More information about the Yum-devel mailing list