[PATCH] Use Unicode in the TUI buffer strings (#1015620)

Vratislav Podzimek vpodzime at redhat.com
Mon Oct 7 08:46:38 UTC 2013


On Fri, 2013-10-04 at 16:39 -0400, David Shea wrote:
> ---
>  pyanaconda/ui/tui/simpleline/base.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
> index 8c2424b..f47be2d 100644
> --- a/pyanaconda/ui/tui/simpleline/base.py
> +++ b/pyanaconda/ui/tui/simpleline/base.py
> @@ -25,6 +25,7 @@ import sys
>  import Queue
>  import getpass
>  import threading
> +import types
>  from pyanaconda.threads import threadMgr, AnacondaThread
>  from pyanaconda.ui.communication import hubQ
>  from pyanaconda import constants
> @@ -729,6 +730,9 @@ class Widget(object):
>          if not text:
>              return
>  
> +        if type(text) != types.UnicodeType:
> +            text = unicode(text)
> +
I'm afraid this needs to do something like 'text = text.decode("utf-8")'
which passes for ascii and utf-8 encoded unicode. Doing it in the
try-except block may replace the type() test. The except block should
probably raise some descriptive exception telling us what happened.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list