Closed mubaris closed 6 years ago
oo interesting I'll take a look
@nirum Thanks
Hey @mubaris,
So the issue is that it is difficult to identify the display width for international languages using unicode... I found the wcwidth package was able to help with this somewhat. The current version (0.8) gets closer to the correct width, but is still off. I'll keep working on it.
p.s. I like your translation package! super useful utility
other useful links regarding display width:
https://www.recurse.com/blog/74-a-string-of-unexpected-lengths https://stackoverflow.com/questions/30881811/how-do-you-get-the-display-width-of-combined-unicode-characters-in-python-3 https://stackoverflow.com/questions/33351599/how-do-i-get-the-visible-length-of-a-combining-unicode-string-in-python
Just to follow up: it seems like determining the display with of arbitrary unicode strings is quite difficult to do in practice. This blog post (https://norasandler.com/2017/11/02/Around-the-with-Unicode.html) doesn't offer any ideas (see the section 'How long is a string?'), and this blog post (http://blog.jonnew.com/posts/poo-dot-length-equals-two) has similar problems in javascript ...
closing for now
I tried to use this module in my script, But got irregular table width.
Can you help on this?