Skip to content

After setting the width of the table, Chinese characters may appear with incorrect line breaks. #127

Description

@yangyunzhao

Talk is cheap, Let me show you my code.

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

using namespace tabulate;

int main() {
    Table table;
    table.add_row({"ID", "Status", "Score"});
    table.add_row({"1", "✔ Passed", "85"});
    table.add_row({"2", "✘ Failed", "40"});
    table.add_row({"3", "✔ Passed", "95"});
    table.add_row({"4", "这是一条非常长的中文注释,可以解析吗?", "95"});
    table.add_row({"5", "Is there any problem with this very long English comment?", "95"});

    table.column(1).format().multi_byte_characters(true);
    table.column(1).format().width(20);

    table[1][1].format().font_color(Color::green);
    table[2][1].format().font_color(Color::red);
    table[3][1].format().font_color(Color::green);

    std::cout << table << std::endl;
    return 0;
}

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions