Robpol86 / terminaltables

Project no longer maintained.
https://github.com/matthewdeanmartin/terminaltables
MIT License
689 stars 70 forks source link

Colum width is wrong if emoji is used #52

Open StShadow opened 6 years ago

StShadow commented 6 years ago

Follow snippet draws a table with incorrect width for column with Unicode smile (for example 😵, dizzy face, Unicode: U+1F635, UTF-8: F0 9F 98 B5).

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    table_data = [['😵'], ['😵']]
    from terminaltables import SingleTable
    table = SingleTable(table_data)
    print table.table
StShadow commented 6 years ago

Result: screen shot 2017-09-19 at 16 16 23

tadgh commented 6 years ago

I also have this issue, would love to see it addressed at some point :+1:

10gic commented 6 years ago

@StShadow @tadgh There is a command line utility YATG, option --width1-chars=emoji can avoid this issue.

johndavidsimmons commented 5 years ago

Please address this issue. It would be greatly appreciated

StShadow commented 5 years ago

Seems it works now

image

$ sw_vers ProductName: Mac OS X ProductVersion: 10.14.2 BuildVersion: 18C54

iTerm2 v3.2.5 Terminal v2.9.1 (421.1)