tablewriter
tablewriter copied to clipboard
Wrong table formatting when using warning unicode symbol
Table is incorrectly formatted when warning symbol is used ⚠️(U+26A0). Other symbols such as ✅ (U+2705) are not affected. The problem didn't exist with
github.com/mattn/go-runewidth
v0.0.3
package main
import (
"os"
"github.com/olekukonko/tablewriter"
)
func main() {
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Test collumn", "Unicode"})
table.Append([]string{"test", ""})
table.Append([]string{"test", "⚠️"})
table.Render()
}
go.mod
module table
go 1.12
require (
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/olekukonko/tablewriter v0.0.1
)
go.sum
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88=
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
output:
+--------------+---------+
| TEST COLLUMN | UNICODE |
+--------------+---------+
| test | |
| test | ⚠️ |
+--------------+---------+
tablewriter
is using go-runewidth
to calculate the width of string. This issue might be related to https://github.com/mattn/go-runewidth/issues/28.
tablewriter
is usinggo-runewidth
to calculate the width of string. This issue might be related to mattn/go-runewidth#28.
looks like that's fixed would you be able to upgrade the dependency on this project? @olekukonko
https://github.com/olekukonko/tablewriter/commit/9627d02c9655319c8e1e36b8ef7f18d15c87d974 looks like this is already updated and this issue should be closed.