x_x icon indicating copy to clipboard operation
x_x copied to clipboard

Two Unicode Bugs

Open illuz opened this issue 9 years ago • 0 comments

If the excels contain Unicode...

First, the words cannot aligned correctly.

$ x_x Test.xlsx 
+------+------+
| A    | B    |
+------+------+
| test | test |
| 测试   | 测试   |
| abcd | abcd |

Second, it cannot specify a Unicoded row as the header.

$ x_x -h 0 Test.xlsx 
+------+------+
| test | test |
+------+------+
| 测试   | 测试   |
| abcd | abcd |
$ 
$ x_x -h 1 Test.xlsx
Traceback (most recent call last):
  File "/usr/local/bin/x_x", line 9, in <module>
    load_entry_point('x-x==0.8', 'console_scripts', 'x_x')()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/x_x/x_x.py", line 46, in cli
    asciitable.draw(XCursor(sheet, heading), out=out)
  File "/usr/local/lib/python2.7/dist-packages/x_x/asciitable.py", line 126, in draw
    heading_sizes = [len(str(x)) for x in headings]
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

illuz avatar Mar 25 '15 04:03 illuz