duckdb icon indicating copy to clipboard operation
duckdb copied to clipboard

Tables containing multi-byte characters are displayed incorrectly in the CLI on Windows

Open eitsupi opened this issue 3 years ago • 5 comments

What happens?

The number of spaces in the header line appears to be different between Windows and Linux.

On Linux

image

On Windows

image

To Reproduce

It can be reproduced by reading the following CSV.

a,b
文字,文字
select * from read_csv('test.csv', header=True, columns={'a':'varchar', 'b':'varchar'});

OS:

Windows

DuckDB Version:

v0.5.0 109f932c4

DuckDB Client:

CLI

Full Name:

SHIMA Tatsuya

Affiliation:

parsonal

Have you tried this on the latest master branch?

  • [X] I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • [X] I agree

eitsupi avatar Sep 09 '22 13:09 eitsupi

try another font

l1t1 avatar Sep 12 '22 00:09 l1t1

As @l1t1 mentioned, it looks like you are not using a fixed-width font in your shell on Windows. Either switch to a fixed-width font, or use a different display mode that is not dependent on DuckDB knowing rendering sizes (e.g. .mode columns or .mode csv). Detecting the font used in the shell and adjusting rendering based on that is out of scope for the project.

Mytherin avatar Sep 16 '22 09:09 Mytherin

Thanks for your answer. Sorry for the confusion, but the top and bottom are drawn with exactly the same font and terminal (Windows Terminal). It's not the font difference, it's the spacing number difference.

eitsupi avatar Sep 16 '22 09:09 eitsupi

Ah, you are correct. The problem is that we are not using linenoise on Windows and fallback to using SQLite's rendering which does not correctly account for unicode characters.

Mytherin avatar Sep 16 '22 09:09 Mytherin

I opened a similar issue https://github.com/duckdb/duckdb/issues/2546

l1t1 avatar Sep 20 '22 13:09 l1t1

It seems already fixed in the latest version (v0.6.1)?

eitsupi avatar Dec 13 '22 12:12 eitsupi

Yes, this should be fixed as part of the duckbox render mode.

Mytherin avatar Dec 13 '22 13:12 Mytherin

Awesome! That works very nicely, thanks!

eitsupi avatar Dec 13 '22 13:12 eitsupi