From b1cebe9e0e550d23107873e5ee31bb700f3c4e6d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 25 Aug 2016 14:21:46 +0300 Subject: [PATCH] Fix unicode issue when search libraries --- platformio/commands/lib.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 3b434e43..8f39f7fe 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -127,6 +127,10 @@ def echo_liblist_header(): def echo_liblist_item(item): + description = item.get("description", item.get("url", "")).encode("utf-8") + if "version" in item: + description += " | @" + click.style(item['version'], fg="yellow") + click.echo( LIBLIST_TPL.format( id=click.style( @@ -137,10 +141,9 @@ def echo_liblist_item(item): ", ".join( item.get("frameworks", ["-"]) + item.get("platforms", [])), fg="yellow"), - authornames=", ".join(item.get("authornames", ["Unknown"])), - description=item.get("description", item.get("url", ""))) + - (" | @" + click.style( - item['version'], fg="yellow") if "version" in item else "")) + authornames=", ".join(item.get("authornames", ["Unknown"])).encode( + "utf-8"), + description=description)) @cli.command("search", short_help="Search for library")