ASCII-Data icon indicating copy to clipboard operation
ASCII-Data copied to clipboard

Padding malfunction for full-width characters

Open windymelt opened this issue 1 year ago • 0 comments

Hi, I suggest some improvement for this great library.

In East Asian languages, including Japanese, characters are represented with a width twice that of ASCII. This is expressed as full width in Unicode.

This library seems to calculate the amount of padding simply by character count, so if input that includes full-width characters is given, the table display will be corrupted.

Since there are libraries that determine whether Unicode characters are full-width or not[1], it would be possible to render the table accurately by improving the algorithm that calculates the amount of padding.

Actual output:

image

Thanks!

[1] https://unicode-org.github.io/icu-docs/apidoc/dev/icu4j/com/ibm/icu/lang/UCharacter.html#getIntPropertyValue-int-int-

windymelt avatar Dec 18 '22 10:12 windymelt