Strings in Python have the wrong number of bytes

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com

It’s an interesting dive into bytes and strings:

The width of a Unicode string differs from the number of characters in it. Fortunately, we can use the POSIX standard function wcswidth to calculate the display width of a Unicode string. We can use this function to rebuild our basic formatting functionality.

Source