spectreconsole / wcwidth Goto Github PK
View Code? Open in Web Editor NEWA .NET library that calculates the width of Unicode characters.
License: MIT License
A .NET library that calculates the width of Unicode characters.
License: MIT License
Hello,
I made several improvements to the accuracy of the python wcwidth library that this library might benefit from. I also wrote a specification, which might help with how you parse the unicode data files. I also wrote an automatic terminal assessment tool.
Most especially you will want to follow the improvements made in release 0.2.9 and 0.2.10 to the zero-width tables and support for Variation Selector-16 with a new VS-16 table.
I wrote an article about it all here, https://www.jeffquast.com/post/ucs-detect-test-results/
Hi,
As far as I can tell, the internals of this library all use uint
which is what one would expect since the tables contain code point values. However, the public UnicodeCalculator
API only speaks char
. This is a bit of a problem since a .NET char
is a UTF-16 code unit, not a Unicode code point / scalar. Many code points that are contained in the tables here can't actually be looked up, severely limiting the usefulness (and correctness) of the library. (This is also out of line with other language ports of this library, including the Python one linked in the README.)
.NET Core 3.0 introduced the System.Text.Rune
type (along with str.EnumerateRunes()
) which would probably be ideal for the API to work with since an instance of Rune
is guaranteed to be a valid Unicode scalar (i.e. a valid Unicode code point that isn't a surrogate). But since taking a dependency on that type is probably undesirable for this library due to targeting .NET Standard 2.0, simply accepting uint
would work too.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.