p-ranav / tabulate

Table Maker for Modern C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strings containing emoji characters have incorrectly sized cells

mmatheson opened this issue · comments

On Linux:

    tabulate::Table example;
    example.add_row({"header"});
    example.add_row({"✔"});
    example.print(std::cout);

Generates

+--------+
| header |
+--------+
| ✔    |
+--------+

You should enable multi-byte character support using example.format().

For performance reasons, this is disabled by default.

See more here.

#include <tabulate/table.hpp>
#include <iostream>

int main() {
  tabulate::Table example;
  example.add_row({"header"});
  example.add_row({""});

  example.format()
    .multi_byte_characters(true);

  std::cout << example << "\n";
}

should print:

+--------+
| header |
+--------+
| ✓      |
+--------+

Please confirm that this works on your side. If it does, please close the issue.

Yep that works, thanks for the help!