Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong table formatting when using warning unicode symbol #141

Open
TSkrebe opened this issue Sep 6, 2019 · 3 comments
Open

Wrong table formatting when using warning unicode symbol #141

TSkrebe opened this issue Sep 6, 2019 · 3 comments

Comments

@TSkrebe
Copy link

TSkrebe commented Sep 6, 2019

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         | ⚠️      |
+--------------+---------+
@upwell
Copy link

upwell commented Apr 15, 2020

tablewriter is using go-runewidth to calculate the width of string. This issue might be related to mattn/go-runewidth#28.

@harshavardhana
Copy link

tablewriter is using go-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

@harshavardhana
Copy link

9627d02 looks like this is already updated and this issue should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants