Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #9646 (closed)

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

Bug: CLI is not unicode safe

Reported by: jamoore Owned by: sbesson
Priority: major Milestone: OMERO-4.4.7
Component: Client Version: n.a.
Keywords: n.a. Cc:
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: n.a.
Sprint: 2012-10-23 (1)

Description

bin/omero user list

can be off by a column if unicode is present:

| xxxxxxx          | wim
| xxxxxxx          | fra
| xxxx             | jia
| Klußmaxxxxxxxxx | bklu
| xxxxxxxx         | jos
| xxxxxxxxx        | tom
| xxxx             | t.c

An initial attempt:

diff --git a/components/tools/OmeroPy/src/omero/util/text.py b/components/tools/OmeroPy/src/omero/util/text.py
index 0959cdc..68d407f 100644
--- a/components/tools/OmeroPy/src/omero/util/text.py
+++ b/components/tools/OmeroPy/src/omero/util/text.py
@@ -72,8 +72,16 @@ class Column(list):
 
     def __init__(self, name, data, align=ALIGN.LEFT):
         list.__init__(self, data)
-        self.name = name
-        self.width = max(len(str(x)) for x in data + [name])
+        self.name = name.encode("utf-8")
+        self.width = len(self.name)
+        for x in data:
+            if isinstance(x, (str, unicode)):
+                x = x.encode("utf-8")
+            else:
+                x = str(x)
+            sz = len(x)
+            if sz > self.width:
+                self.width = sz
         self.format = ' %%%s%ds ' % (align, self.width)
 
 

failed.

Change History (5)

comment:1 Changed 7 years ago by jmoore

Referencing ticket #2571 has changed sprint.

comment:2 Changed 7 years ago by sbesson

  • Owner set to sbesson
  • Sprint set to 2012-10-23 (1)

comment:3 Changed 7 years ago by sbesson

  • Status changed from new to accepted

comment:4 Changed 7 years ago by sbesson

  • Resolution set to fixed
  • Status changed from accepted to closed

comment:5 Changed 7 years ago by jean-marie burel <j.burel@…>

(In [6acd29b59423ff4fcb5dac1ce37cb2a7b93aac39/ome.git] on branch develop) Merge pull request #418 from sbesson/9646_unicode

Fix table display for Unicode characters (see #9646)

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.84605 sec.)

We're Hiring!