wcwidth is a Python library that measures the displayed width of Unicode strings in a terminal, ensuring accurate text formatting. The current version is 0.6.0, released on January 22, 2022. The library is actively maintained with a release cadence of approximately every few months.
pip install wcwidthVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to import the wcwidth function and use it to measure the width of a Unicode string.
Update your code to be compatible with Unicode version 17.0.0 and remove any reliance on the 'unicode_version' keyword.
Remove the 'unicode_version' keyword from your wcwidth() function calls.
Regularly test your application with diverse Unicode characters to identify and handle any width measurement issues.
Ensure that wcwidth() is called with a single character. If you need to calculate the width of an entire string, iterate over its characters and sum their individual widths or use a helper function designed for strings.
Ensure that the argument passed to `wcwidth()` is either a single string or an iterable of individual characters. If you need to calculate the width of multiple strings, concatenate them into a single string or call `wcwidth()` for each string individually and sum the results.
pip install wcwidth
from wcwidth import wcwidth
Pass only a single character to `wcwidth.wcwidth()`, or use `wcwidth.wcswidth()` for an entire string.
Ensure the input to `wcwidth.wcwidth()` is always a single Unicode character string.
Handle the -1 return value by filtering out or replacing such characters, or understand that it signifies a character with no display width; for full string width, use `wcwidth.wcswidth()`.
No dependency data recorded yet.