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

Vratislav Podzimek vpodzime at redhat.com
Tue Oct 8 07:18:48 UTC 2013


On Mon, 2013-10-07 at 13:36 -0400, David Shea wrote:
> If there is an error decoding the string as utf-8, raise an exception
> containing the failing string in the message.
> ---
>  pyanaconda/ui/tui/simpleline/base.py | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
> index 8c2424b..a9b1438 100644
> --- a/pyanaconda/ui/tui/simpleline/base.py
> +++ b/pyanaconda/ui/tui/simpleline/base.py
> @@ -729,6 +729,12 @@ class Widget(object):
>          if not text:
>              return
>  
> +        try:
> +            text = text.decode("utf-8")
> +        except UnicodeDecodeError as e:
> +            raise ValueError("Unable to decode string %s" %
> +                    str(e.object).decode("utf-8", "replace"))
> +
>          if row is None:
>              row = self._cursor[0]
Nice! ACK.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list